Account created on 28 July 2009, over 15 years ago
#

Recent comments

🇳🇱Netherlands koosvdkolk

Thanks for reaching out!

Can the batch implementation be called from hook_update? For us this is the key part: we want to remove permissions in hook_update.

P.S. We currently just use the OP code and call that, so for us it is not really an issue if you decide to leave RIP as it is.

🇳🇱Netherlands koosvdkolk

Got the same error on Drupal 10.3.6...

In addition, I also got the following error after trying to save the text format with MR !2 in place:

'allowed_html' is an unknown key because filters.extended_html_filter.id is extended_html_filter (see config schema type filter_settings.*).

Folks at https://www.drupal.org/project/shortcode had the same issue, and it was solved here https://www.drupal.org/project/shortcode/issues/3457731#comment-15681072 🐛 Unable to save text format config form in 10.3 Fixed

So I managed to solve the additional error by adding a file

config/schema/extended_html_filter.schema.yml

with contents

filter_settings.extended_html_filter:
  type: sequence
  sequence:
    type: boolean
🇳🇱Netherlands koosvdkolk

Can #15 please be merged?

🇳🇱Netherlands koosvdkolk

#14 works on core 10.3.6

Can this please be merged?

🇳🇱Netherlands koosvdkolk

Patch in #15 works like a charm. Thanks @adamfranco!

🇳🇱Netherlands koosvdkolk

By the way, to have configurable HTML filtering in place: I just got CKEditor + Ckeditor_media_resize + patch #16 to work with https://www.drupal.org/project/htmlpurifier , although unfortunately also with a patch: https://www.drupal.org/project/htmlpurifier/issues/3375949#comment-15775125 💬 Unable to Use HTML Purifier Needs review . I just installed html purifier, applied the patch, enabled it for the text format and put it as the last filter.

🇳🇱Netherlands koosvdkolk

@Ihridley: Would you be so kind to

  1. In a empty CKeditor, insert an image
  2. Copy the contents of CKeditor 'source'
  3. Resize the image
  4. Copy the contents of CKeditor 'source'
  5. Resize the image
  6. Copy the contents of CKeditor 'source'
  7. Past the results of step 2, 4 and 6 here?

This might help us to find out what is going wrong.

P.S. I dont get the 'BTW' part: Who requested to open a new issue? Who merged what?

🇳🇱Netherlands koosvdkolk

Thanks @alrh!

Updated the status of this ticket (not sure if it is the right one)

🇳🇱Netherlands koosvdkolk

Seems to work!

This is how I tested:

1) Set the retention period to 'Indefinitely'
2) drush core-cron
3) Logs still there
4) Set the period to 'None'
5) drush core-cron
6) Logs gone

🇳🇱Netherlands koosvdkolk

Thanks @nessthehero and @davedg629!

The only disturbing thing for me is that I do not understand why #16 works. Maybe it works because of some bug in ckeditor, and will it stop working once that bug has been fixed...

@damienmckenna How could we move on from here?

🇳🇱Netherlands koosvdkolk

@nessthehero: Thanks!

Just to be sure, are you on the latest version of ckeditor_media_resize? https://www.drupal.org/project/ckeditor_media_resize/releases/1.0.0-beta2

If I repeat the steps you mention with https://www.drupal.org/project/ckeditor_media_resize/releases/1.0.0-beta2 , I get no errors, the tag has no attribute 'undefined' and the width is correct.

I also would not understand how my fix would cause this error, as it just mimics pressing the 'Original' button...

🇳🇱Netherlands koosvdkolk

It seems I have something workable, but it feels kinda hacky.

When the user presses the 'Original' button, CKEditor is told: set the width to 'null'. So in the code executing after the user stopped dragging the resize handle, I added a line of code which does the same.

So:

e.execute("resizeMediaImage", { width: null }); //Reset the width.
e.execute("resizeMediaImage", { width: i });

Because the JS is being 'compiled' and minified, to allow for quick testing I attached the deminified & compiled version of mediaResize.js (had to add _.txt otherwise I could not upload it here).

This mediaResize.js is located in /js/build:

Could you please
1) Download mediaResize.js_.txt to that folder
2) Rename the existing mediaResize.js to e.g. mediaResize.old
3) Rename the mediaResize.js_.txt to mediaResize.js
4) Clear cache and test (without "Limit allowed HTML tags and correct faulty HTML" of course)

🇳🇱Netherlands koosvdkolk

Not it is indeed not acceptable, but apparently this plugin can work without the "Limit allowed HTML tags and correct faulty HTML" filter...

🇳🇱Netherlands koosvdkolk

By the way, yesterday it seems I found a workaround. I disabled "Limit allowed HTML tags and correct faulty HTML".

I added an image and resized it: worked.

I reloaded the edit page and resized it: does not work (one can see this in the 'source' in CKeditor).

Then, I first clicked 'Original' and then did a resize: worked.

Could someone else confirm this?

🇳🇱Netherlands koosvdkolk

Unfortunately we could not wait for this issue to be solved. Our use case requires inline media only, so we wrote a small patch module, which turns all stuff into inline-block HTML.

It consists of code altering CKEditor behavior and a text filter. Theme CSS is required for correct display in the front-end (see README in lb_ckeditor_media_fix.zip).

Sharing it here as it might help some others.

Please note that this module has a very narrow use case and is really meant as a band-aid!

🇳🇱Netherlands koosvdkolk

My use case is that I want to show field_a in the table, but field_b when field_a is empty.

🇳🇱Netherlands koosvdkolk

Diving into the code, and I do not understand how this module should work.

* I have enabled features_permissions
* I have a Feature containing the permissions AND the roles

I enable the Feature.

This is what happens: PermissionManager::syncRoleToPermissions is called for each new role in the Feature. Below arrays are all empty.

$added_permissions = array_diff($permissions, $permissions_original)

End result:
* Roles are present
* Permissions are present
* No permissions are added to roles.

So indeed my $0.02 would be that features_permissions tries receives the events in the wrong order in my use case: it tries to add yet-to-be-imported Feature permissions to Feature roles.

🇳🇱Netherlands koosvdkolk

My mistake.

I enabled the "Strip out user permissions." and now the role ymls do not have the permissions anymore.

So in my Feature, both the roles and (all) permissions are present. The role ymls do not contain permissions, the permission ymls contain roles. So far, so good. Nevertheless, the permissions are not added when I enable the Feature.

What strikes me: If I enable my Feature and perform a 'drush fim' afterwards, it asks me to import the roles defined in the Feature.

Could it be that for some reason, the roles are not imported yet at the moment the permissions get imported and hence, the permission assignment does not take place?

🇳🇱Netherlands koosvdkolk

@justcaldwell: Thanks for your solution. I agree with your suggestion: menu items should have a unique reference for both their route and their location within the menu.

I ended up with using the 'href' as a pseudo-classname:

E.g to target 'Overview' in the 'Add content' sub menu:

.gin--vertical-toolbar .toolbar-menu .toolbar-menu .toolbar-menu li > a[href="/node/add"] {
  border: 1px solid red !important;
}
🇳🇱Netherlands koosvdkolk

Asked @solariel to dive into this:

"From what I see, CKeditor5 is to blame. If you disable Drupal's 'allowed_html', a CKeditor's will be used and it'll break media resize by not allowed data attributes it's using."

🇳🇱Netherlands koosvdkolk

Please forgive me my ignorance, but why is the "Limit allowed HTML tags and correct faulty HTML" filter required for this module in order to work?

🇳🇱Netherlands koosvdkolk

Any update on this? For us this is also a blocker.

🇳🇱Netherlands koosvdkolk

+1

I really hate the auto-detect functionality: It brings more harm than good, especially now that Features should be used for (very) advanced use cases where Drupal's vanilla config management is too limited. Please just let the site admin decide what should go where.

P.S. Before I forget: Did I already give a HUGE THANKS for all the work that went into this great module? Thanks a lot guys!

🇳🇱Netherlands koosvdkolk

Got it to work:

/**
 * Implements hook_inline_entity_form_entity_form_alter.
 *
 * @return void
 */
function my_module_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  if ($entity_form['#entity_type'] == 'my_entity_type' && $entity_form['#bundle'] == 'my_entity_bundle') {
    $element_id = join('_', $entity_form['#parents']); // Obtain unique id for the wrapper
    $entity_form['select_a']['widget']['#ajax'] = [
      'callback' => 'my_module_form_select_update_ajax_callback',
      'event' => 'change',
      'wrapper' => $element_id,
    ];
    $entity_form['select_b']['#prefix'] = '<div id="'. $element_id .'">';
    $entity_form['select_b']['#suffix'] = '</div>';
  }
}

/**
 * Ajax callback.
 *
 * @param array $complete_form
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *
 * @return array
 */
function my_module_form_select_update_ajax_callback(array &$complete_form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $select_a_form_element = $form_state->getTriggeringElement();
  $selected_entity_id = (int) $select_a_form_element['#value'];

  // Find select b in the form.
  $form_part = NestedArray::getValue($complete_form, array_slice($select_a_form_element['#array_parents'], 0, -2));
  $select_b_form_element = $form_part['select_b'];

  // Get options.
  $options = [];
  if ($selected_entity_id>=0) {
    // Add options here based on the entity id.
  }

  // Return new select b.
  $select_b_form_element['widget']['#options'] = $options;
  return $select_b_form_element;
}
🇳🇱Netherlands koosvdkolk
<?php
if ($option_name !== 'replace' && empty($this->configuration[$option_name])) {
?>

seems to do the trick.

🇳🇱Netherlands koosvdkolk

This is how my colleague got it to work in D10 (so without Composer):

  1. You download https://www.drupal.org/project/h5p/releases/2.0.0-alpha3 and put is somewhere into web/modues manually
  2. You add "h5p/h5p-core": "1.24.4" "h5p/h5p-editor": "1.24.4" via composer
  3. You apply patch https://www.drupal.org/files/issues/2023-06-27/drupal.org_files_issues_2...
  4. Go to web/modules/.../h5p/src/H5PDrupal/H5PDrupal.php:241 and replace
    $cachedAsset = $optimizer->optimize($assets);

    with this

    $cachedAsset = $optimizer->optimize($assets, []);

  5. You install h5p and h5peditor modules
  6. Add an h5p reference field to any content type
  7. Select h5p editor widget (it will support both editing and uploading this way)
  8. It'll still throw warnings on uploads and deprecation errors
🇳🇱Netherlands koosvdkolk

Thanks for the suggestion!

We considered something similar, but then you should at least ensure that (the correct) stuff is being deleted when the user eventually presses Cancel buttons...

🇳🇱Netherlands koosvdkolk

The blocks currently include:

1. Children: list of child pages for the current page
2. Navigation: Replicates the navigation links found at the bottom of the page.
3. Table of Contents: Book's table of contents that also includes a link to
the top page.
4. Edit: Includes a combination of navigation, table of contents and edit
links.

🇳🇱Netherlands koosvdkolk

Very much in need of this.

We ended up creating a 'wrapper' node type, having an entity reference to our non-node content entity, and then all kinds of hackish code to mimic standard book behavior for the non-node content entity...

🇳🇱Netherlands koosvdkolk

This module is exactly what we need! It would be great if you @droces could re-open the application!

🇳🇱Netherlands koosvdkolk

Found bug in #2, new attempt.

🇳🇱Netherlands koosvdkolk

First attempt. Written against 2.0.3

Production build 0.71.5 2024