You are here

protected function MapThemerBase::buildDefaultMapThemerRow in Geofield Map 8.2

Builds the base table row for multivalue MapThemer.

Parameters

array $row: The row configuration.

Return value

array The table row render array.

6 calls to MapThemerBase::buildDefaultMapThemerRow()
EntityTypeThemer::buildMapThemerElement in src/Plugin/GeofieldMapThemer/EntityTypeThemer.php
Provides a Map Themer Options Element.
EntityTypeThemerUrl::buildMapThemerElement in src/Plugin/GeofieldMapThemer/EntityTypeThemerUrl.php
Provides a Map Themer Options Element.
ListFieldThemer::buildMapThemerElement in src/Plugin/GeofieldMapThemer/ListFieldThemer.php
Provides a Map Themer Options Element.
ListFieldThemerUrl::buildMapThemerElement in src/Plugin/GeofieldMapThemer/ListFieldThemerUrl.php
Provides a Map Themer Options Element.
TaxonomyTermThemer::buildMapThemerElement in src/Plugin/GeofieldMapThemer/TaxonomyTermThemer.php
Provides a Map Themer Options Element.

... See full list

File

src/MapThemerBase.php, line 99

Class

MapThemerBase
A base class for MapThemer plugins.

Namespace

Drupal\geofield_map

Code

protected function buildDefaultMapThemerRow(array $row) {
  $element = [
    'label' => [
      '#type' => 'value',
      '#value' => $row['label']['value'],
      'markup' => [
        '#markup' => $row['label']['markup'],
      ],
    ],
    'weight' => [
      '#type' => 'weight',
      '#title' => '',
      '#title_display' => 'invisible',
      '#default_value' => $row['weight']['value'],
      '#delta' => 20,
      '#attributes' => [
        'class' => [
          $row['weight']['class'],
        ],
      ],
    ],
    'label_alias' => [
      '#type' => 'textfield',
      '#default_value' => $row['label_alias']['value'],
      '#size' => 30,
      '#maxlength' => 128,
    ],
    'icon_file' => array_key_exists('icon_file_id', $row) ? $this->markerIcon
      ->getIconFileManagedElement($row['icon_file_id'], $row['id']) : (array_key_exists('icon_file_uri', $row) ? $this->markerIcon
      ->getIconFileSelectElement($row['icon_file_uri'], $row['id']) : NULL),
    'image_style' => array_key_exists('icon_file_id', $row) ? [
      '#type' => 'select',
      '#title' => $this
        ->t('Image style'),
      '#title_display' => 'invisible',
      '#options' => $row['image_style']['options'],
      '#default_value' => $row['image_style']['value'],
      '#states' => [
        'visible' => [
          ':input[name="style_options[map_marker_and_infowindow][theming]' . $row['id'] . '[icon_file][is_svg]"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ] : [],
    // @TODO: Monitor this core issue that prevents correct legend_exclude default
    // value via ajax:
    // Checkboxes default value is ignored by forms system during processing
    // of AJAX request (https://www.drupal.org/project/drupal/issues/1100170)
    'legend_exclude' => [
      '#type' => 'checkbox',
      '#default_value' => $row['legend_exclude']['value'],
      '#return_value' => 1,
    ],
    'image_style_svg' => array_key_exists('icon_file_id', $row) ? [
      '#type' => 'container',
      'warning' => [
        '#markup' => $this
          ->t("Image style cannot apply to SVG Files,<br>SVG natural dimension will be applied."),
      ],
      '#states' => [
        'invisible' => [
          ':input[name="style_options[map_marker_and_infowindow][theming]' . $row['id'] . '[icon_file][is_svg]"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ] : [],
    '#attributes' => $row['attributes'],
  ];
  return $element;
}