You are here

public static function ParagraphOperations::preRenderDropbutton in Paragraphs 8

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

Overrides Dropbutton::preRenderDropbutton

File

src/Element/ParagraphOperations.php, line 25

Class

ParagraphOperations
Plugin annotation @RenderElement("paragraph_operations");

Namespace

Drupal\paragraphs\Element

Code

public static function preRenderDropbutton($element) {
  $element = parent::preRenderDropbutton($element);

  // Attach #ajax events if title is a render array.
  foreach ($element['#links'] as &$link) {
    if (isset($link['title']['#ajax'])) {
      $link['title'] = RenderElement::preRenderAjaxForm($link['title']);
    }
  }
  return $element;
}