You are here

protected static function YamlFormElementStates::buildOperations in YAML Form 8

Build a state's operations.

Parameters

string $table_id: The option element's table id.

int $row_index: The option's row index.

array $ajax_settings: An array containing AJAX callback settings.

Return value

array A render array containing state operations..

2 calls to YamlFormElementStates::buildOperations()
YamlFormElementStates::buildConditionRow in src/Element/YamlFormElementStates.php
Build condition row.
YamlFormElementStates::buildStateRow in src/Element/YamlFormElementStates.php
Build state row.

File

src/Element/YamlFormElementStates.php, line 320

Class

YamlFormElementStates
Provides a form element to edit an element's #states.

Namespace

Drupal\yamlform\Element

Code

protected static function buildOperations($table_id, $row_index, array $ajax_settings) {
  $operations = [];
  $operations['add'] = [
    '#type' => 'image_button',
    '#src' => drupal_get_path('module', 'yamlform') . '/images/icons/plus.svg',
    '#limit_validation_errors' => [],
    '#submit' => [
      [
        get_called_class(),
        'addConditionSubmit',
      ],
    ],
    '#ajax' => $ajax_settings,
    '#row_index' => $row_index,
    '#name' => $table_id . '_add_' . $row_index,
  ];
  $operations['remove'] = [
    '#type' => 'image_button',
    '#src' => drupal_get_path('module', 'yamlform') . '/images/icons/ex.svg',
    '#limit_validation_errors' => [],
    '#submit' => [
      [
        get_called_class(),
        'removeRowSubmit',
      ],
    ],
    '#ajax' => $ajax_settings,
    '#row_index' => $row_index,
    '#name' => $table_id . '_remove_' . $row_index,
  ];
  return $operations;
}