You are here

public function WebformMultiple::getInfo in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Element/WebformMultiple.php \Drupal\webform\Element\WebformMultiple::getInfo()

Returns the element properties for this element.

Return value

array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format.

Overrides ElementInterface::getInfo

File

src/Element/WebformMultiple.php, line 28

Class

WebformMultiple
Provides a webform element to assist in creation of multiple elements.

Namespace

Drupal\webform\Element

Code

public function getInfo() {
  $class = get_class($this);
  return [
    '#input' => TRUE,
    '#access' => TRUE,
    '#key' => NULL,
    '#header' => NULL,
    '#element' => [
      '#type' => 'textfield',
      '#title' => t('Item value'),
      '#title_display' => 'invisible',
      '#placeholder' => t('Enter value…'),
    ],
    '#cardinality' => FALSE,
    '#min_items' => NULL,
    '#item_label' => $this
      ->t('item'),
    '#no_items_message' => $this
      ->t('No items entered. Please add items below.'),
    '#empty_items' => 1,
    '#add_more' => TRUE,
    '#add_more_items' => 1,
    '#add_more_button_label' => $this
      ->t('Add'),
    '#add_more_input' => TRUE,
    '#add_more_input_label' => $this
      ->t('more items'),
    '#sorting' => TRUE,
    '#operations' => TRUE,
    '#add' => TRUE,
    '#ajax_attributes' => [],
    '#table_attributes' => [],
    '#table_wrapper_attributes' => [],
    '#remove' => TRUE,
    '#process' => [
      [
        $class,
        'processWebformMultiple',
      ],
    ],
    '#theme_wrappers' => [
      'form_element',
    ],
    // Add '#markup' property to add an 'id' attribute to the form element.
    // @see template_preprocess_form_element()
    '#markup' => '',
  ];
}