outside_in_toolbar_alter(&$items)
Implements hook_toolbar_alter().
Includes outside_library if Edit link is in toolbar.
File
- core/modules/outside_in/outside_in.module, line 108
- Allows configuring blocks and other configuration from the site front-end.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function outside_in_toolbar_alter(& $items ) { $items [ 'contextual' ][ '#cache' ][ 'contexts' ][] = 'outside_in_is_applied' ; if (isset( $items [ 'contextual' ][ 'tab' ]) && \Drupal::service( 'outside_in.manager' )->isApplicable()) { $items [ 'contextual' ][ '#weight' ] = -1000; $items [ 'contextual' ][ '#attached' ][ 'library' ][] = 'outside_in/drupal.outside_in' ; $items [ 'contextual' ][ 'tab' ][ '#attributes' ][ 'data-drupal-outsidein' ] = 'toggle' ; // Set a class on items to mark whether they should be active in edit mode. // @todo Create a dynamic method for modules to set their own items. $edit_mode_items = [ 'contextual' , 'block_place' ]; foreach ( $items as $key => $item ) { if (!in_array( $key , $edit_mode_items ) && (!isset( $items [ $key ][ '#wrapper_attributes' ][ 'class' ]) || !in_array( 'hidden' , $items [ $key ][ '#wrapper_attributes' ][ 'class' ]))) { $items [ $key ][ '#wrapper_attributes' ][ 'class' ][] = 'edit-mode-inactive' ; } } } } |
Please login to continue.