class ActionsDropbutton

Replaces the process callback for dropbuttons on an "actions" element.

@BootstrapProcess("actions__dropbutton", replace = "Drupal\Core\Render\Element\Actions::preRenderActionsDropbutton", )

@todo Remove once core is fixed.


Expanded class hierarchy of ActionsDropbutton

See Also

Related topics


class ActionsDropbutton extends ProcessBase implements ProcessInterface {

   * {@inheritdoc}
  public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
    $dropbuttons = Element::create();
    foreach ($element->children(TRUE) as $key => $child) {
      if ($dropbutton = $child->getProperty('dropbutton')) {
        // If there is no dropbutton for this button group yet, create one.
        if (!isset($dropbuttons->$dropbutton)) {
          $dropbuttons->$dropbutton = ['#type' => 'dropbutton'];

        $dropbuttons[$dropbutton]['#links'][$key] = ['title' => $child->getArray()];

        // Remove original child from the element so it's not rendered twice.
        $child->setProperty('printed', TRUE);
    $element->exchangeArray($dropbuttons->getArray() + $element->getArray());



Contains filters are case sensitive
Name Modifiers Type Description
ActionsDropbutton::processElement public static function Process a specific form element. Overrides ProcessBase::processElement
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
ProcessBase::process public static function Process a specific form element type. Overrides ProcessInterface::process