You are here

protected function AssociativeArrayWidget::valueForm in Map Widget 8

Helper function to build the value form element array.

Parameters

array $value: The value.

int $count: The number of array elements.

bool $required: Is the value required?

Return value

array The render array.

1 call to AssociativeArrayWidget::valueForm()
AssociativeArrayWidget::formElement in src/Plugin/Field/FieldWidget/AssociativeArrayWidget.php
Returns the form for a single field widget.

File

src/Plugin/Field/FieldWidget/AssociativeArrayWidget.php, line 143

Class

AssociativeArrayWidget
Plugin implementation of the 'map_item_widget' widget.

Namespace

Drupal\map_widget\Plugin\Field\FieldWidget

Code

protected function valueForm(array $value, $count, $required) {
  return [
    '#type' => 'map_associative',
    '#default_value' => $value,
    '#key_placeholder' => $this
      ->getSetting('key_placeholder'),
    '#value_placeholder' => $this
      ->getSetting('value_placeholder'),
    '#size' => $this
      ->getSetting('size'),
    '#count' => $count,
    '#required' => $required,
  ];
}