Thanks @apaderno :-)
silverham → created an issue.
Thanks all for adjusting the patch and writing tests, I don't time/know how to do all these things. 🙂
Thank you @imyaro 😊🥳
Thank you @admirlju for helping 🥰
+1 for interest on getting this one commited.
silverham → created an issue.
silverham → created an issue.
Closing this issue in favour of the orginal issue
🐛
SvgImageUrlFormatter parent construct wrong order
Needs review
where the newly attached patch fixes both issues buy using the suggestion (thanks!) to not override __construct()
method but also reuse the parent create()
method, then assign property after object creation so it will be compatible with future releases.
Attaching a new patch that does not override the __construct()
method, nor does it define the specific parameter order in its own create()
method.
Rather, it assigns the required extra class property after the class creation by overriding create()
method, calling the parent create method, then assigning the paramater, so then it is compatible with all versions of Drupal core including Drupal 10. (Thanks to comment
#3388971-3: SvgImageUrlFormatter parent construct missing arguments 10 needed 9 passed. →
for the pointer).
I am closing the duplicate issue in
🐛
SvgImageUrlFormatter parent construct missing arguments 10 needed 9 passed.
Active
as this patch fixes both issues. Additionally, the reason why the initial patch in the linked ticket does not work is because it defines the parameter order in it's create()
method, rather reusing the parent create()
method.
Oops patch only appiles for dev version due to different info.yml, attached patch for 3.4 module version for composer runs.
Compose wouldn't apply #14, so regenerated the same patch (no changes).
Attched patch to remove hook_uninstall()
. I note that drupal_uninstall_schema()
is no longer required since D7 and removed in D10.
@see https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
@see
https://www.drupal.org/docs/7/converting-drupal-6-modules-to-drupal-7/co... →
See attached patch for 8.x-1.x version of this module.
silverham → created an issue.
See attached patch.
silverham → created an issue.
I had to also set the default command to use for lando.
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['query']['command'] = ini_get('sendmail_path') . ' -t';
Attached patch.
silverham → created an issue.
Attached patch.
silverham → created an issue.
silverham → created an issue.
Attached patch, sorry no tests.
silverham → created an issue.
Note: If filter is in an exposed block, then #3067937: Views Exposed Filter Block not inheriting the display handlers cache tags, causing filter options not to appear → needs to be applied.
Attached patch, no tests. Also moved $base_table_view = $config->get('base_table');
since is only need outside of foreach loop.
Attached patch, no tests. Also moved $base_table_view = $config->get('base_table');
since is only need outside of foreach loop.
silverham → created an issue.
Correct patch.
Actually this issue only appears in Drupal 9.4.x. In Drupal 9.5.x/10.x/11.x, the order is correct. Attaching patch to detect version.
Echoing sentiment :-(
All of our JavaScript/jQuery will have to be updated too.
From:
[my_theme.libraries.yml]
global-js:
version: 1.0
js:
assets/js/main.js: {}
dependencies:
- core/jquery
[main.js]
(function ($, Drupal, once) {
Drupal.behaviors.myThemeOrModule = {
// Both single or multiple elements is fine.
$('.selector', context).addClass('my-class');
// Multiple elements.
$('.views-row', context).each(function(i, element) {
$(element).addClass('my-class');
});
};
})(jQuery, Drupal, once);
To:
[my_theme.libraries.yml]
global-js:
version: 1.0
js:
assets/js/main.js: {}
dependencies:
- core/jquery
- core/once
[main.js]
(function ($, Drupal, once) {
Drupal.behaviors.myThemeOrModule = {
// Both single or multiple elements is fine.
$(once('my-unique-once-id', '.selector', context)).addClass('my-class');
// Multiple elements.
$(once('my-unique-once-id', '.selector', context)).each(function(index, element) {
$(element).addClass('my-class');
});
// OR use native once's return array => forEach() but note you that can't use jQuery selector extensions like `div:visible`, without calling jQuery like `once([...]).filter(':visible')`
once('my-unique-once-id', '.selector', context).forEach(function (element, index) {
$(element).addClass('my-class');
});
};
})(jQuery, Drupal, once);
Once API is documented here: https://www.npmjs.com/package/@drupal/once
[do not NPM install it, it is already in drupal core, ass add line via libraries.yml :-) ]
This error is also preventing form from on saving my Drupal views. Please commit fix.
Views error:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter::__construct(): Argument #8 ($current_user) must be of type Drupal\Core\Session\AccountInterface, Drupal\image\ImageStyleStorage given, called in /app/build/web/modules/contrib/svg_image/src/Plugin/Field/FieldFormatter/SvgImageUrlFormatter.php on line 41 in Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter->__construct() (line 78 of core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php).
Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter->__construct('image_url', Array, Object, Array, '', '_custom', Array, Object, Object) (Line: 41)
Drupal\svg_image\Plugin\Field\FieldFormatter\SvgImageUrlFormatter->__construct('image_url', Array, Object, Array, '', '_custom', Array, Object, Object, Object) (Line: 59)
Drupal\svg_image\Plugin\Field\FieldFormatter\SvgImageUrlFormatter::create(Object, Array, 'image_url', Array) (Line: 64)
Drupal\Core\Field\FormatterPluginManager->createInstance('image_url', Array) (Line: 126)
Drupal\Core\Field\FormatterPluginManager->getInstance(Array) (Line: 1002)
Drupal\views\Plugin\views\field\EntityField->getFormatterInstance() (Line: 1020)
Drupal\views\Plugin\views\field\EntityField->calculateDependencies() (Line: 71)
Drupal\views\Plugin\views\display\DisplayPluginBase->getPluginDependencies(Object) (Line: 89)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies(Object, 17)
array_walk(Array, Array) (Line: 959)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculateDependencies() (Line: 71)
Drupal\Core\Config\Entity\ConfigEntityBase->getPluginDependencies(Object) (Line: 89)
Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object) (Line: 282)
Drupal\views\Entity\View->calculateDependencies() (Line: 319)
Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object) (Line: 292)
Drupal\views\Entity\View->preSave(Object) (Line: 562)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 517)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 607)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 991)
Drupal\views_ui\ViewUI->save() (Line: 337)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 270)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 137)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Trying to trigger test system.
Attaching draft patch for Drupal test system without attachments.
Rerolled against latest release 8.x-1.3.
For those who find this via Search engines, you can pipe to `drush php-eval` like follows, depending on what style you like in bash.
read -r -d '' DRUSH_TEMP_COMMAND <<'EOF'; ./vendor/bin/drush php-eval "$DRUSH_TEMP_COMMAND"
var_dump(\Drupal::service('file_system')->getTempDirectory());
var_dump("TEST2");
EOF
OR
DRUSH_TEMP_COMMAND=$(cat <<'END'
var_dump(\Drupal::service('file_system')->getTempDirectory());
var_dump("TEST");
END
); ./vendor/bin/drush php-eval "$DRUSH_TEMP_COMMAND"
@see https://stackoverflow.com/questions/2500436/how-does-cat-eof-work-in-bas...
@see https://stackoverflow.com/questions/1167746/how-to-assign-a-heredoc-valu...
FYI module doesn't seem very stable.
Filter can only added AFTER a relationship has been saved and the view saved, and the relationship to the nodes must be the first one (instead of a relationship selector available).
The query parameter field is also not automatically populated.
Rerolled #6 (->accessCheck(TRUE)
), my local composer wasn't applying the patch for some reason.
Any progress on this?
+1 to this. I also have issues loading the temporary parent node entity in hook_field_widget_single_element_form_alter()
This work around for now is to use : $node = $parent_entity = $form_state->getFormObject()->getEntity();
Sample code below shows how to set the form default values as you enter paragraphs depending on how many.
/**
* Implements hook_field_widget_single_element_PLUGIN_ID_form_alter().
*
* @see \Drupal\Core\Field\WidgetBase::formSingleElement()
*/
function my_module_field_widget_single_element_string_textfield_form_alter(array &$element, FormStateInterface $form_state, array $context) {
$field_name = $context['items']->getName();
$default_value = 'My default value to compare';
if (($field_name == 'field_my_text_field')
&& ($context['items']->getEntity()->getEntityTypeId() == 'paragraph')
&& ($context['items']->getEntity()->bundle() == 'my_paragraph_type')) {
$field_parents_no_subform = array_slice($element['#field_parents'], 0, -2);
$parent_field_name = end($field_parents_no_subform);
// Don't use $context['items']->getEntity()->getParentEntity()
// it gets the current database node not the form temp node.
// @see https://www.drupal.org/project/paragraphs/issues/3255456
$parent_entity = $form_state->getFormObject()->getEntity();
// Change new fields default to empty, by
if ($parent_entity->hasField($parent_field_name)) {
$values = $parent_entity->get($parent_field_name)->getValue();
if ((count($values) > 1) && ($element['value']['#default_value'] == $default_value)) {
$element['value']['#default_value'] = '';
}
}
// Change existing fields from default to empty.
$input = $form_state->getUserInput();
if (isset($input[$parent_field_name])) {
$field_structure = array_merge(
$element['#field_parents'],
[
$field_name,
'0',
'value',
]
);
// Get Value at
// $input['field_parent'][$context['delta']]['subform'][$field_name]['0']['value'];.
$current_value = NestedArray::getValue($input, $field_structure);
if ($current_value == $default_value) {
NestedArray::setValue($input, $field_structure, '');
$form_state->setUserInput($input);
}
}
}
}
Updated patch to use a do a null check as per suggested : isset($this->connection)
.
Didn't use isset($this->connectionHandle)
in subclass is it is private (no subclass access to parent) and all sub-classes still use naming convention of $this->connection
Interesting, I see that ftp_connect()
and ssh2_connect()
both return a non-NULL value, so FALSE or a resource object so an isset()
check could work. I can redo patch later, or feel free to do yourself if you get to it first, no worries.
This fix is now causing a regression, as $object->connect()
is called recursively and nested calls to PHP magic methods with the same parameters are ignored by PHP engine. So Drupal\Core\FileTransfer\FTPExtension->connect()
no longer works. @see
🐛
[regression] FTPExtension class can no longer connect as of 9.5.x
Needs work
.
Notice: Undefined property: Drupal\Core\FileTransfer\FTPExtension::$connection in Drupal\Core\FileTransfer\FTPExtension->connect() (line 16 of core/lib/Drupal/Core/FileTransfer/FTPExtension.php).
Patch based on running FTPExtension->connect() ;
once.
silverham → created an issue.