You are here

public function WebformDialogLocalAction::getOptions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/Menu/LocalAction/WebformDialogLocalAction.php \Drupal\webform\Plugin\Menu\LocalAction\WebformDialogLocalAction::getOptions()

Returns options for rendering a link for the local action.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

Return value

array An associative array of options.

Overrides LocalActionDefault::getOptions

File

src/Plugin/Menu/LocalAction/WebformDialogLocalAction.php, line 18

Class

WebformDialogLocalAction
Defines a local action plugin with the needed dialog attributes.

Namespace

Drupal\webform\Plugin\Menu\LocalAction

Code

public function getOptions(RouteMatchInterface $route_match) {
  $options = parent::getOptions($route_match);
  if (isset($this->pluginDefinition['dialog'])) {
    $attributes = WebformDialogHelper::getModalDialogAttributes($this->pluginDefinition['dialog']);
  }
  elseif (isset($this->pluginDefinition['off_canvas'])) {
    $attributes = WebformDialogHelper::getOffCanvasDialogAttributes($this->pluginDefinition['off_canvas']);
  }
  else {
    $attributes = [];
  }
  $options['attributes'] = isset($this->pluginDefinition['attributes']) ? $this->pluginDefinition['attributes'] : [];
  $options['attributes'] = NestedArray::mergeDeep($options['attributes'], $attributes);
  return $options;
}