outside_in_contextual_links_view_alter

outside_in_contextual_links_view_alter(&$element, $items)

Implements hook_contextual_links_view_alter().

Change Configure Blocks into offcanvas links.

File

core/modules/outside_in/outside_in.module, line 35
Allows configuring blocks and other configuration from the site front-end.

Code

function outside_in_contextual_links_view_alter(&$element, $items) {
  if (isset($element['#links']['outside-inblock-configure'])) {
    $element['#links']['outside-inblock-configure']['attributes'] = [
      'class' => ['use-ajax'],
      'data-dialog-type' => 'dialog',
      'data-dialog-renderer' => 'offcanvas',
      'data-outside-in-edit' => TRUE,
    ];

    $element['#attached']['library'][] = 'outside_in/drupal.off_canvas';
  }
}
doc_Drupal
2016-10-29 09:32:43
Comments
Leave a Comment

Please login to continue.