Feature request: Please offer default values for the attributes.

Created on 24 February 2023, almost 2 years ago
Updated 26 July 2023, over 1 year ago

Problem/Motivation

Feature request: Please offer default values for the attributes.

With previous versions, I had written my own code to extend the advanced links module to populate default values into some of the attributes it adds to links. It looked something like this:

function my_module_form_editor_link_dialog_alter(&$form, FormStateInterface $form_state, $form_id) {
  $link_element = $form_state->get('attributes');
  if (empty($link_element['href'])) {
    $form['attributes']['class']['#default_value'] = 'my-custom-classname';
  }
}

However with the upgrade to CKEditor5, our custom code no longer works.

I'm about to go try to get it working again, but I thought this might also be a good moment to suggest adding it as a feature to the module that default values for the attributes could be configured in the editor plugin settings, alongside the tickboxes to turn them on or off.

I think it would be a useful feature for a lot of site owners.

Thank you.

Feature request
Status

Active

Version

2.1

Component

Code

Created by

🇬🇧United Kingdom Spudley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024