1 common.inc backdrop_pre_render_dropbutton($element)

Pre-render callback: Attaches the dropbutton library and required markup.

File

core/includes/common.inc, line 6416
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_pre_render_dropbutton($element) {
  $element['#attached']['library'][] = array('system', 'backdrop.dropbutton');
  $element['#attributes']['class'][] = 'dropbutton';
  if (!isset($element['#theme_wrappers'])) {
    $element['#theme_wrappers'] = array();
  }
  array_unshift($element['#theme_wrappers'], 'dropbutton_wrapper');

  // Enable targeted theming of specific dropbuttons (e.g., 'operations' or
  // 'operations__node').
  if (isset($element['#subtype'])) {
    $element['#theme'] .= '__' . $element['#subtype'];
  }

  return $element;
}