πŸ‡ΊπŸ‡ΈUnited States @jimmynash

Account created on 17 March 2008, over 16 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Applying this patch seems to get past the upgrade path issues I had when first trying to update to CKEditor5.
When implementing the buttons into a profile though I get errors when loading the editor on fields.

Background Color and Font Color buttons throw this error and do not allow the editor to load.

TypeError: r.ColorSelectorView is not a constructor
    colorSelectorView https://mysite.local/modules/contrib/ckeditor_font/js/build/font.js?seo4bv:671
    init https://mysite.local/modules/contrib/ckeditor_font/js/build/font.js?seo4bv:674
    create https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    n https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    fillFromConfig https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    _initToolbar https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    init https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    create https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    promise callback*create/< https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    create https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    attach https://mysite.local/core/modules/ckeditor5/js/ckeditor5.js?seo4bv:174
    editorAttach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:148
    attach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:108
    attach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:99
    attachBehaviors https://mysite.local/core/misc/drupal.js?v=9.5.11:24
    attachBehaviors https://mysite.local/core/misc/drupal.js?v=9.5.11:21
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:24
    listener https://mysite.local/core/misc/drupal.init.js?v=9.5.11:14
    domReady https://mysite.local/core/misc/drupal.init.js?v=9.5.11:20
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:23
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:26
ckeditor5.js:201:17

FontFamily and FontSize plugins throw this error and prevent the editor from loading.

TypeError: t is not iterable
    _setUpBindToBinding https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    using https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    pe https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    init https://mysite.local/modules/contrib/ckeditor_font/js/build/font.js?seo4bv:322
    create https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    n https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    fillFromConfig https://mysite.local/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=35.4.0:5
    _initToolbar https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    init https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    create https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    promise callback*create/< https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    create https://mysite.local/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=35.4.0:4
    attach https://mysite.local/core/modules/ckeditor5/js/ckeditor5.js?seo4bv:174
    editorAttach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:148
    attach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:108
    attach https://mysite.local/core/modules/editor/js/editor.js?v=9.5.11:99
    attachBehaviors https://mysite.local/core/misc/drupal.js?v=9.5.11:24
    attachBehaviors https://mysite.local/core/misc/drupal.js?v=9.5.11:21
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:24
    listener https://mysite.local/core/misc/drupal.init.js?v=9.5.11:14
    domReady https://mysite.local/core/misc/drupal.init.js?v=9.5.11:20
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:23
    <anonymous> https://mysite.local/core/misc/drupal.init.js?v=9.5.11:26
ckeditor5.js:201:17

Taking the all of these buttons out of the profile allows the editor to load again.

Drupal 9.5.11
FireFox 126.0.1

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Here is a patch based on #58 and #59 that is working for me against beta10.

It does have some other code for hiding descriptions and titles that is different than the original patches.

#59 did take care of the problems with ajax submit after the view had been paginated or filtered. But there was some strange
behavior around the entity field values not all saving as mentioned in #60.

I added a bit to reload the entity before setting the field values and this seems to take care of that. I'm not sure that it's the most
performant thing to do though. Take that with a grain of salt.

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Tested MR5 against Core 9.5.11 with Linkit Media Library 1.0.3

Patch applied cleanly and the resulting functionality was as desired.

The button does show up in the Linkit dialog in CKEditor5 and works to insert the media link.
Seems to play nice with editor_advanced_link module as well.

Thanks!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Patch in #27 works well against 2.0.3 as well. I like the ability to customize the login images this way.

Thanks!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

@MingSong Well done! I was looking for an email OTP to replace the functionality of tfa_basic that we were using on D7.

Installed your plugin module to a site using 1.5 of TFA and it works a treat. Thank you!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

I just wanted to note this here on this issue because it ended up being a simple workaround for us in a pinch:
https://www.drupal.org/project/feeds_tamper/issues/2983197#comment-14954757 πŸ› Catch TamperException to prevent import from crashing Needs review

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Tested patch in #19 and it cleared the problem for me after a fresh install of 2.0.0

Thanks!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Just chiming in. This patch fixes an issue I was experiencing with Entity Form Steps β†’ where unlimited file fields were displaying strangely exactly as the attached screenshot.

Unfortunately I don't have the skill to write a test for this as of yet to contribute.

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Confirmed. Adding the patch to core from the merge request does fix the issue.
https://git.drupalcode.org/project/drupal/-/merge_requests/2141/diffs.patch

Thanks!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

I just tested the new version and it works perfectly. Required fields not filled when using previous do not stop the user, but fields that have been set retain their value when returning to that step.

Excelsior!!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Sorry that this strayed a little from the purpose of the module but your assistance has been invaluable.

The example you sent put me on the right path and now I do get a prefilled paragraph that the user can alter if needed before moving on from that step. The key was that hook_field_widget_paragraphs_form_alter.

By using the entity builder you mentioned I'm able to look for the existence of the previous field value and set that address as the #default_value on the paragraph subform address.

/**
 * Implements hook_field_widget_WIDGET_TYPE_form_alter().
 */
function MYMODULE_field_widget_paragraphs_form_alter(&$element, &$form_state, $context) {
  if ($element['#paragraph_type'] == 'location') {

    $entity = $form_state->getFormObject()->getEntity();
    $ins_addr = $entity->get('field_insured_address')->getValue()[0];

    if( $ins_addr['address_line1'] ) {
      $element['subform']['field_address']['widget'][0]['address']['#default_value'] = $ins_addr;
    }
  }
}

Super huge kudos @robphillips!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Well, the paragraph part is being rather stubborn. At least, setting it on the main entity form.

I can create it and I can access the previous address field now using the complete_form_alter api hook.
But it just won't show as part of the form when I try and use

$form_state->setValue('field_locations', $paragraph);

I've tried with the form field config set to have a default location paragraph and without. My goal is to have an editable, prefilled paragraph sitting there at that step for the user to accept or modify before moving on.

I tried setting it on the entity as well and that seems to do nothing either. Even finishing the form, neither ends up adding this paragraph to the node.

I feel like this is a paragraphs thing but I can't be sure.

I'll keep trying and post back if I get it.

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Thanks for the reply and example!

I have been using just a normal hook_form_formid_alter and was trying to use $form_state->getValues() to get what I needed but each time I would dump those values to look at them I just had the values from the step previous.

This is generally what I was trying to do. An address field provided earlier in the form should be pre-filled into a paragraph at the end of the form.
I haven't gotten to seeing if the paragraph stuff works yet as I was having trouble getting the previous address to use.

Basically this:

/**
 * Used to alter the entire form
 * Implements hook_form_FORMID_alter()
 */
function MYMODULE_form_FORMID_alter(&$form, FormStateInterface $form_state, $form_id) {

  if( $steps && ($steps['current_step'] == 'group_locations') ) {
    $addr = $form_state->getValues('field_address');
    $paragraph = Paragraph::create([
      'type' => 'location',  // paragraph type machine name
      'field_address2' => $addr,
    ]);

    $form_state->setValue('field_locations', $paragraph);
  }

}

So should I be using the provided api hook to do any form altering from my modules?
hook_entity_form_steps_complete_form_alter

Maybe you could tell me if I'm generally right in these assumptions:

hook_entity_form_steps_complete_form_alter is for altering entity forms under entity_form_steps control.

hook_entity_form_steps_state_alter is for altering what step the user is on

hook_entity_form_steps_alter is for altering the steps themselves such as button labels etc that are set in the field group configurations.

Do I have that right?

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Would it be possible to provide it as an option per group instance?

I can see a need for one group of the same type to use autoaccept while another wants to provide the second step after invite.

If a per instance group setting would be too difficult, I would vote for option 1 (autoaccept toggle per group type).

πŸ‡ΊπŸ‡ΈUnited States jimmynash

I feel like this issue is related to 3185060.

The patch in #6 there helped me deal with a problem using VBO against a content type using image_field_caption.

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Patch in #6 helped with a problem using views bulk operations.

Trying to use VBO and Views Bulk Edit to change the taxonomy terms across a content type that was using image_field_caption resulted in the following error.

Error: Call to undefined method Drupal\views_bulk_operations\Form\ConfigureAction::getEntity() in _image_field_caption_widget_process() (line 49 of /code/web/modules/contrib/image_field_caption/image_field_caption.module)

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Just chiming in. Patch in #5 fixed me right up. Thanks!

πŸ‡ΊπŸ‡ΈUnited States jimmynash

I took a swing at turning this patch into a module.

Media Entity Download CKEditor (sandbox) β†’

There are a few differences that I think are notable:

  • The module uses the settings from the Media Embed plugin to launch that Media Browser.
  • Included is a filter that replaces the UUID returned by that browser.

The main reasons for this were that the autocomplete option in the patch modal wasn't quite what I wanted for my editors.
I wasn't quite sure how to get my own put together so I piggyback off of the Media Embed browser.

The form in that browser returns the UUID of the entity so I added the filter to convert that UUID into the media id.

The filter could be removed I think if media_entity_download could use both of these paths:

  • media/{media_id}/download
  • media/{media_uuid}/download

I think this is the relevant post for that: Entities can now be linked to by their UUID β†’

Finally, I'm not a fan of piggybacking off of the Media Embed plugin settings to get the browser I want. I'm sure there is a better way to do that, I just don't understand it yet.

πŸ‡ΊπŸ‡ΈUnited States jimmynash

Attaching patch. I'm not really sure if this is the right way to attack this.

Maybe it's better to have the date_popup module add support for this?

Production build 0.69.0 2024