Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
- outside_in_contextual_links_view_alter() has this code:
if (isset($element['#links']['outside-inblock-configure'])) { $element['#links']['outside-inblock-configure']['attributes'] = [
'outside-inblock-configure'
seems like a strange name, especially without a hyphen between 'in' and 'block'. Searching the codebase for that string doesn't uncover where it comes from. Where it comes from is thatoutside_in.links.contextual.yml
definesoutside_in.block_configure
, the keys of $element['#links'] in the above function are generated via Html::getClass() of the YML-defined link identifiers, and Html::getClass() converts '.' to empty string rather than hyphen.
Proposed resolution
Option 1:
Change the outside_in_contextual_links_view_alter() code to something like:
$link_class = Html::getClass('outside_in.block_configure');
if (isset($element['#links'][$link_class])) {
$element['#links'][$link_class]['attributes'] = [
That's fine for the PHP side. However, what about JS code such as $(e.target).find('li.outside-inblock-configure a')
?
Option 2:
Is there an option 2?
Comments
Comment #2
naveenvalechaComment #3
tkoleary CreditAttribution: tkoleary at Acquia commentedComment #4
tedbowI say we don't worry about this because machine name of module is going to changed to settings_tray anyways so all of these will be changed.
See #2803375: Rename Outside-in module to "Settings Tray" for real
Comment #5
tedbowChanging to new settings_tray.module component. @drpal thanks for script help! :)