- Issue created by @Spudley
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.
Active
2.1
Code