You are here

function webform_ui_preprocess_menu_local_action in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_ui/webform_ui.module \webform_ui_preprocess_menu_local_action()

Implements hook_preprocess_menu_local_action().

Add .button--secondary to add page and layout actions.

See also

Drupal.behaviors.webformUiElementsActionsSecondary

File

modules/webform_ui/webform_ui.module, line 54
Provides a simple user interface for building and maintaining webforms.

Code

function webform_ui_preprocess_menu_local_action(&$variables) {
  if (\Drupal::routeMatch()
    ->getRouteName() !== 'entity.webform.edit_form') {
    return;
  }
  if (in_array($variables['link']['#url']
    ->getRouteName(), [
    'entity.webform_ui.element.add_page',
    'entity.webform_ui.element.add_layout',
  ])) {
    $variables['link']['#options']['attributes']['class'][] = 'button--secondary';
  }
}