You are here

protected function WebformUiEntityElementsForm::getCustomizeActionsRow in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_ui/src/WebformUiEntityElementsForm.php \Drupal\webform_ui\WebformUiEntityElementsForm::getCustomizeActionsRow()

Get customize actions row.

Return value

array The customize actions row.

1 call to WebformUiEntityElementsForm::getCustomizeActionsRow()
WebformUiEntityElementsForm::buildForm in modules/webform_ui/src/WebformUiEntityElementsForm.php
Form constructor.

File

modules/webform_ui/src/WebformUiEntityElementsForm.php, line 736

Class

WebformUiEntityElementsForm
Webform manage elements UI form.

Namespace

Drupal\webform_ui

Code

protected function getCustomizeActionsRow() {

  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = $this
    ->getEntity();
  $row = [];
  $row['#attributes']['class'] = [
    'webform-ui-element-type-webform_actions',
  ];
  $row['title'] = [
    '#type' => 'link',
    '#title' => $this
      ->t('Submit button(s)'),
    '#url' => new Url('entity.webform_ui.element.add_form', [
      'webform' => $webform
        ->id(),
      'type' => 'webform_actions',
    ], [
      'query' => [
        'key' => 'actions',
      ],
    ]),
    '#attributes' => WebformDialogHelper::getOffCanvasDialogAttributes(),
  ];
  if ($webform
    ->hasContainer()) {
    $row['add'] = [
      '#markup' => '',
    ];
  }
  $row['name'] = [
    '#markup' => 'actions',
  ];
  $row['type'] = [
    '#markup' => $this
      ->t('Submit button(s)'),
  ];
  if ($webform
    ->hasFlexboxLayout()) {
    $row['flex'] = [
      '#markup' => 1,
    ];
  }
  if ($webform
    ->hasConditions()) {
    $row['conditions'] = [
      '#markup' => '',
    ];
  }
  $row['required'] = [
    '#markup' => '',
  ];
  $row['weight'] = [
    '#markup' => '',
    '#wrapper_attributes' => [
      'class' => [
        'webform-tabledrag-hide',
      ],
    ],
  ];
  $row['parent'] = [
    '#markup' => '',
    '#wrapper_attributes' => [
      'class' => [
        'webform-tabledrag-hide',
      ],
    ],
  ];
  if ($this->elementManager
    ->isExcluded('webform_actions')) {
    $row['operations'] = [
      '#markup' => '',
    ];
  }
  else {
    $row['operations'] = [
      '#type' => 'operations',
      '#prefix' => '<div class="webform-dropbutton">',
      '#suffix' => '</div>',
    ];
    $row['operations']['#links']['customize'] = [
      'title' => $this
        ->t('Customize'),
      'url' => new Url('entity.webform_ui.element.add_form', [
        'webform' => $webform
          ->id(),
        'type' => 'webform_actions',
      ]),
      'attributes' => WebformDialogHelper::getOffCanvasDialogAttributes(),
    ];
  }
  return $row;
}