You are here

class CivicrmEntityAddressLeafletMap in CiviCRM Entity 8.3

Style plugin to render a View output as a Leaflet map.

Attributes set below end up in the $this->definition[] array.

Plugin annotation


@ViewsStyle(
  id = "civicrm_entity_address_leaflet_map",
  title = @Translation("CiviCRM Entity Address Leaflet Map"),
  help = @Translation("Displays a View as a Leaflet map."),
  display_types = {"normal"},
  theme = "leaflet-map"
)

Hierarchy

Expanded class hierarchy of CivicrmEntityAddressLeafletMap

File

modules/civicrm_entity_leaflet/src/Plugin/views/style/CivicrmEntityAddressLeafletMap.php, line 32

Namespace

Drupal\civicrm_entity_leaflet\Plugin\views\style
View source
class CivicrmEntityAddressLeafletMap extends LeafletMap {

  /**
   * Get a list of fields and a sublist of geo data fields in this view.
   *
   * @return array
   *   Available data sources.
   */
  protected function getAvailableDataSources() {
    $fields_geo_data = [];

    /* @var \Drupal\views\Plugin\views\ViewsHandlerInterface $handler) */
    foreach ($this->displayHandler
      ->getHandlers('field') as $field_id => $handler) {
      $label = $handler
        ->adminLabel() ?: $field_id;
      $this->viewFields[$field_id] = $label;
      if (is_a($handler, '\\Drupal\\views\\Plugin\\views\\field\\EntityField')) {
        $fields_geo_data[$field_id] = $label;
      }
    }
    return $fields_geo_data;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {

    // If data source changed then apply the changes.
    if ($form_state
      ->get('entity_source')) {
      $this->options['entity_source'] = $form_state
        ->get('entity_source');
      $this->entityInfo = $this
        ->getEntitySourceEntityInfo($this->options['entity_source']);
      $this->entityType = $this->entityInfo
        ->id();
      $this->entitySource = $this->options['entity_source'];
    }
    StylePluginBase::buildOptionsForm($form, $form_state);
    $form['#tree'] = TRUE;
    $form['#attached'] = [
      'library' => [
        'leaflet/general',
      ],
    ];

    // Get a sublist of geo data fields in the view.
    $fields_geo_data = $this
      ->getAvailableDataSources();
    $wrapper_id = 'leaflet-map-views-style-options-form-wrapper';
    $form['#prefix'] = '<div id="' . $wrapper_id . '">';
    $form['#suffix'] = '</div>';

    // Map preset.
    $form['data_source_lat'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Data Source Latitude'),
      '#description' => $this
        ->t('Which field contains the latitude?'),
      '#options' => $fields_geo_data,
      '#default_value' => $this->options['data_source_lat'],
      '#required' => TRUE,
    ];
    $form['data_source_lon'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Data Source Longitude'),
      '#description' => $this
        ->t('Which field contains longitude?'),
      '#options' => $fields_geo_data,
      '#default_value' => $this->options['data_source_lon'],
      '#required' => TRUE,
    ];

    // Get the possible entity sources.
    $entity_sources = $this
      ->getAvailableEntitySources();

    // If there is only one entity source it will be the base entity, so don't
    // show the element to avoid confusing people.
    if (count($entity_sources) == 1) {
      $form['entity_source'] = [
        '#type' => 'value',
        '#value' => key($entity_sources),
      ];
    }
    else {
      $form['entity_source'] = [
        '#type' => 'select',
        '#title' => new TranslatableMarkup('Entity Source'),
        '#description' => new TranslatableMarkup('Select which Entity should be used as Leaflet Mapping base Entity.<br><u>Leave as "View Base Entity" to rely on default Views behaviour, and don\'t specifically needed otherwise</u>.'),
        '#options' => $entity_sources,
        '#default_value' => !empty($this->options['entity_source']) ? $this->options['entity_source'] : '__base_table',
        '#ajax' => [
          'wrapper' => $wrapper_id,
          'callback' => [
            static::class,
            'optionsFormEntitySourceSubmitAjax',
          ],
          'trigger_as' => [
            'name' => 'entity_source_submit',
          ],
        ],
      ];
      $form['entity_source_submit'] = [
        '#type' => 'submit',
        '#value' => new TranslatableMarkup('Update Entity Source'),
        '#name' => 'entity_source_submit',
        '#submit' => [
          [
            static::class,
            'optionsFormEntitySourceSubmit',
          ],
        ],
        '#validate' => [],
        '#limit_validation_errors' => [
          [
            'style_options',
            'entity_source',
          ],
        ],
        '#attributes' => [
          'class' => [
            'js-hide',
          ],
        ],
        '#ajax' => [
          'wrapper' => $wrapper_id,
          'callback' => [
            static::class,
            'optionsFormEntitySourceSubmitAjax',
          ],
        ],
      ];
    }

    // Name field.
    $form['name_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Title Field'),
      '#description' => $this
        ->t('Choose the field which will appear as a title on tooltips.'),
      '#options' => array_merge([
        '' => ' - None - ',
      ], $this->viewFields),
      '#default_value' => $this->options['name_field'],
    ];
    $desc_options = array_merge([
      '' => ' - None - ',
    ], $this->viewFields);

    // Add an option to render the entire entity using a view mode.
    if ($this->entityType) {
      $desc_options += [
        '#rendered_entity' => $this
          ->t('< @entity entity >', [
          '@entity' => $this->entityType,
        ]),
        '#rendered_entity_ajax' => $this
          ->t('< @entity entity via ajax >', [
          '@entity' => $this->entityType,
        ]),
        '#rendered_view_fields' => $this
          ->t('# Rendered View Fields (with field label, format, classes, etc)'),
      ];
    }
    $form['description_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Description Field'),
      '#description' => $this
        ->t('Choose the field or rendering method which will appear as a description on tooltips or popups.'),
      '#required' => FALSE,
      '#options' => $desc_options,
      '#default_value' => $this->options['description_field'],
    ];
    if ($this->entityType) {

      // Get the human readable labels for the entity view modes.
      $view_mode_options = [];
      foreach ($this->entityDisplay
        ->getViewModes($this->entityType) as $key => $view_mode) {
        $view_mode_options[$key] = $view_mode['label'];
      }

      // The View Mode drop-down is visible conditional on "#rendered_entity"
      // being selected in the Description drop-down above.
      $form['view_mode'] = [
        '#type' => 'select',
        '#title' => $this
          ->t('View mode'),
        '#description' => $this
          ->t('View mode the entity will be displayed in the Infowindow.'),
        '#options' => $view_mode_options,
        '#default_value' => $this->options['view_mode'],
        '#states' => [
          'visible' => [
            ':input[name="style_options[description_field]"]' => [
              [
                'value' => '#rendered_entity',
              ],
              [
                'value' => '#rendered_entity_ajax',
              ],
            ],
          ],
        ],
      ];
    }

    // Generate the Leaflet Map General Settings.
    $this
      ->generateMapGeneralSettings($form, $this->options);

    // Generate the Leaflet Map Reset Control.
    $this
      ->setResetMapControl($form, $this->options);

    // Generate the Leaflet Map Position Form Element.
    $map_position_options = $this->options['map_position'];
    $form['map_position'] = $this
      ->generateMapPositionElement($map_position_options);

    // Generate the Leaflet Map weight/zIndex Form Element.
    $form['weight'] = $this
      ->generateWeightElement($this->options['weight']);

    // Generate Icon form element.
    $icon_options = $this->options['icon'];
    $form['icon'] = $this
      ->generateIconFormElement($icon_options);

    // Set Map Marker Cluster Element.
    $this
      ->setMapMarkerclusterElement($form, $this->options);

    // Set Map Geometries Options Element.
    $this
      ->setMapPathOptionsElement($form, $this->options);

    // Set Map Geocoder Control Element, if the Geocoder Module exists,
    // otherwise output a tip on Geocoder Module Integration.
    $this
      ->setGeocoderMapControl($form, $this->options);
  }

  /**
   * Renders the View.
   */
  public function render() {
    $data = [];

    // Collect bubbleable metadata when doing early rendering.
    $build_for_bubbleable_metadata = [];

    // Always render the map, otherwise ...
    $leaflet_map_style = !isset($this->options['leaflet_map']) ? $this->options['map'] : $this->options['leaflet_map'];
    $map = leaflet_map_get_info($leaflet_map_style);

    // Set Map additional map Settings.
    $this
      ->setAdditionalMapOptions($map, $this->options);

    // Add a specific map id.
    $map['id'] = Html::getUniqueId("leaflet_map_view_" . $this->view
      ->id() . '_' . $this->view->current_display);
    if (($lat_field_name = $this->options['data_source_lat']) && ($lon_field_name = $this->options['data_source_lon'])) {
      $this
        ->renderFields($this->view->result);

      /* @var \Drupal\views\ResultRow $result */
      foreach ($this->view->result as $id => $result) {
        $lat_value = (array) $this
          ->getFieldValue($result->index, $lat_field_name);
        $long_value = (array) $this
          ->getFieldValue($result->index, $lon_field_name);
        if (!empty($lat_value) && !empty($long_value)) {
          $features = [
            [
              'type' => 'point',
              'lat' => $lat_value[0],
              'lon' => $long_value[0],
            ],
          ];
          if (!empty($result->_entity)) {

            // Entity API provides a plain entity object.
            $entity = $result->_entity;
          }
          elseif (isset($result->_object)) {

            // Search API provides a TypedData EntityAdapter.
            $entity_adapter = $result->_object;
            if ($entity_adapter instanceof EntityAdapter) {
              $entity = $entity_adapter
                ->getValue();
            }
          }

          // Render the entity with the selected view mode.
          if (isset($entity)) {

            // Get and set (if not set) the Geofield cardinality.

            /* @var \Drupal\Core\Field\FieldItemList $geofield_entity */
            if (!isset($map['geofield_cardinality'])) {
              try {
                $geofield_entity = $entity
                  ->get($geofield_name);
                $map['geofield_cardinality'] = $geofield_entity
                  ->getFieldDefinition()
                  ->getFieldStorageDefinition()
                  ->getCardinality();
              } catch (\Exception $e) {

                // In case of exception it means that $geofield_name field is
                // not directly related to the $entity and might be the case of
                // a geofield exposed through a relationship.
                // In this case it is too complicate to get the geofield related
                // entity, so apply a more general case of multiple/infinite
                // geofield_cardinality.
                // @see: https://www.drupal.org/project/leaflet/issues/3048089
                $map['geofield_cardinality'] = -1;
              }
            }
            $entity_type = $entity
              ->getEntityTypeId();
            $entity_type_langcode_attribute = $entity_type . '_field_data_langcode';
            $view = $this->view;

            // Set the langcode to be used for rendering the entity.
            $rendering_language = $view->display_handler
              ->getOption('rendering_language');
            $dynamic_renderers = [
              '***LANGUAGE_entity_translation***' => 'TranslationLanguageRenderer',
              '***LANGUAGE_entity_default***' => 'DefaultLanguageRenderer',
            ];
            if (isset($dynamic_renderers[$rendering_language])) {

              /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
              $langcode = isset($result->{$entity_type_langcode_attribute}) ? $result->{$entity_type_langcode_attribute} : $entity
                ->language()
                ->getId();
            }
            else {
              if (strpos($rendering_language, '***LANGUAGE_') !== FALSE) {
                $langcode = PluginBase::queryLanguageSubstitutions()[$rendering_language];
              }
              else {

                // Specific langcode set.
                $langcode = $rendering_language;
              }
            }
            switch ($this->options['description_field']) {
              case '#rendered_entity':
                $build = $this->entityManager
                  ->getViewBuilder($entity
                  ->getEntityTypeId())
                  ->view($entity, $this->options['view_mode'], $langcode);
                $render_context = new RenderContext();
                $description = $this->renderer
                  ->executeInRenderContext($render_context, function () use (&$build) {
                  return $this->renderer
                    ->render($build, TRUE);
                });
                if (!$render_context
                  ->isEmpty()) {
                  $render_context
                    ->update($build_for_bubbleable_metadata);
                }
                break;
              case '#rendered_entity_ajax':
                $parameters = [
                  'entity_type' => $entity_type,
                  'entity' => $entity
                    ->id(),
                  'view_mode' => $this->options['view_mode'],
                  'langcode' => $langcode,
                ];
                $url = Url::fromRoute('leaflet_views.ajax_popup', $parameters);
                $description = sprintf('<div class="leaflet-ajax-popup" data-leaflet-ajax-popup="%s" %s></div>', $url
                  ->toString(), LeafletAjaxPopupController::getPopupIdentifierAttribute($entity_type, $entity
                  ->id(), $this->options['view_mode'], $langcode));
                $map['settings']['ajaxPoup'] = TRUE;
                break;
              case '#rendered_view_fields':

                // Normal rendering via view/row fields (with labels options,
                // formatters, classes, etc.).
                $render_row = [
                  "markup" => $this->view->rowPlugin
                    ->render($result),
                ];
                $description = !empty($this->options['description_field']) ? $this->renderer
                  ->renderPlain($render_row) : '';
                break;
              default:

                // Row rendering of single specified field value (without
                // labels).
                $description = !empty($this->options['description_field']) ? $this->rendered_fields[$result->index][$this->options['description_field']] : '';
            }

            // Merge eventual map icon definition from hook_leaflet_map_info.
            if (!empty($map['icon'])) {
              $this->options['icon'] = $this->options['icon'] ?: [];

              // Remove empty icon options so that they might be replaced by
              // the ones set by the hook_leaflet_map_info.
              foreach ($this->options['icon'] as $k => $icon_option) {
                if (empty($icon_option) || is_array($icon_option) && $this->leafletService
                  ->multipleEmpty($icon_option)) {
                  unset($this->options['icon'][$k]);
                }
              }
              $this->options['icon'] = array_replace($map['icon'], $this->options['icon']);
            }

            // Define possible tokens.
            $tokens = [];
            foreach ($this->rendered_fields[$result->index] as $field_name => $field_value) {
              $tokens[$field_name] = $field_value;
              $tokens["{{ {$field_name} }}"] = $field_value;
            }
            $icon_type = isset($this->options['icon']['iconType']) ? $this->options['icon']['iconType'] : 'marker';

            // Relates the feature with additional properties.
            foreach ($features as &$feature) {

              // Attach pop-ups if we have a description field.
              // Add its entity id, so that it might be referenced from outside.
              $feature['entity_id'] = $entity
                ->id();

              // Generate the weight feature property
              // (falls back to natural result ordering).
              $feature['weight'] = !empty($this->options['weight']) ? intval(str_replace([
                "\n",
                "\r",
              ], "", $this
                ->viewsTokenReplace($this->options['weight'], $tokens))) : $id;

              // Attach pop-ups if we have a description field.
              if (isset($description)) {
                $feature['popup'] = $description;
              }

              // Attach also titles, they might be used later on.
              if ($this->options['name_field']) {

                // Decode any entities because JS will encode them again and
                // we don't want double encoding.
                $feature['label'] = !empty($this->options['name_field']) ? Html::decodeEntities($this->rendered_fields[$result->index][$this->options['name_field']]) : '';
              }

              // Eventually set the custom Marker icon (DivIcon, Icon Url or
              // Circle Marker).
              if ($feature['type'] === 'point' && isset($this->options['icon'])) {

                // Set Feature Icon properties.
                $feature['icon'] = $this->options['icon'];

                // Transforms Icon Options that support Replacement
                // Patterns/Tokens.
                if (!empty($this->options["icon"]["iconSize"]["x"])) {
                  $feature['icon']["iconSize"]["x"] = $this
                    ->viewsTokenReplace($this->options["icon"]["iconSize"]["x"], $tokens);
                }
                if (!empty($this->options["icon"]["iconSize"]["y"])) {
                  $feature['icon']["iconSize"]["y"] = $this
                    ->viewsTokenReplace($this->options["icon"]["iconSize"]["y"], $tokens);
                }
                if (!empty($this->options["icon"]["shadowSize"]["x"])) {
                  $feature['icon']["shadowSize"]["x"] = $this
                    ->viewsTokenReplace($this->options["icon"]["shadowSize"]["x"], $tokens);
                }
                if (!empty($this->options["icon"]["shadowSize"]["y"])) {
                  $feature['icon']["shadowSize"]["y"] = $this
                    ->viewsTokenReplace($this->options["icon"]["shadowSize"]["y"], $tokens);
                }
                switch ($icon_type) {
                  case 'html':
                    $feature['icon']['html'] = str_replace([
                      "\n",
                      "\r",
                    ], "", $this
                      ->viewsTokenReplace($this->options['icon']['html'], $tokens));
                    $feature['icon']['html_class'] = $this->options['icon']['html_class'];
                    break;
                  case 'circle_marker':
                    $feature['icon']['options'] = str_replace([
                      "\n",
                      "\r",
                    ], "", $this
                      ->viewsTokenReplace($this->options['icon']['circle_marker_options'], $tokens));
                    break;
                  default:
                    if (!empty($this->options['icon']['iconUrl'])) {
                      $feature['icon']['iconUrl'] = str_replace([
                        "\n",
                        "\r",
                      ], "", $this
                        ->viewsTokenReplace($this->options['icon']['iconUrl'], $tokens));

                      // Generate correct Absolute iconUrl & shadowUrl,
                      // if not external.
                      if (!empty($feature['icon']['iconUrl'])) {
                        $feature['icon']['iconUrl'] = $this->leafletService
                          ->pathToAbsolute($feature['icon']['iconUrl']);
                      }
                    }
                    if (!empty($this->options['icon']['shadowUrl'])) {
                      $feature['icon']['shadowUrl'] = str_replace([
                        "\n",
                        "\r",
                      ], "", $this
                        ->viewsTokenReplace($this->options['icon']['shadowUrl'], $tokens));
                      if (!empty($feature['icon']['shadowUrl'])) {
                        $feature['icon']['shadowUrl'] = $this->leafletService
                          ->pathToAbsolute($feature['icon']['shadowUrl']);
                      }
                    }

                    // Set the Feature IconSize and ShadowSize to the IconUrl or
                    // ShadowUrl Image sizes (if empty or invalid).
                    $this->leafletService
                      ->setFeatureIconSizesIfEmptyOrInvalid($feature);
                    break;
                }
              }

              // Associate dynamic path properties (token based) to each
              // feature, in case of not point.
              if ($feature['type'] !== 'point') {
                $feature['path'] = str_replace([
                  "\n",
                  "\r",
                ], "", $this
                  ->viewsTokenReplace($this->options['path'], $tokens));
              }

              // Associate dynamic className property (token based) to icon.
              $feature['icon']['className'] = !empty($this->options['icon']['className']) ? str_replace([
                "\n",
                "\r",
              ], "", $this
                ->viewsTokenReplace($this->options['icon']['className'], $tokens)) : '';

              // Allow modules to adjust the marker.
              $this->moduleHandler
                ->alter('leaflet_views_feature', $feature, $result, $this->view->rowPlugin);
            }

            // Add new points to the whole basket.
            $data = array_merge($data, $features);
          }
        }
      }
    }

    // Don't render the map, if we do not have any data
    // and the hide option is set.
    if (empty($data) && !empty($this->options['hide_empty_map'])) {
      return [];
    }

    // Order the data features based on the 'weight' element.
    uasort($data, [
      'Drupal\\Component\\Utility\\SortArray',
      'sortByWeightElement',
    ]);
    $js_settings = [
      'map' => $map,
      'features' => $data,
    ];

    // Allow other modules to add/alter the map js settings.
    $this->moduleHandler
      ->alter('leaflet_map_view_style', $js_settings, $this);
    $map_height = !empty($this->options['height']) ? $this->options['height'] . $this->options['height_unit'] : '';
    $element = $this->leafletService
      ->leafletRenderMap($js_settings['map'], $js_settings['features'], $map_height);

    // Add the Core Drupal Ajax library for Ajax Popups.
    if (isset($map['settings']['ajaxPoup']) && $map['settings']['ajaxPoup'] == TRUE) {
      $build_for_bubbleable_metadata['#attached']['library'][] = 'core/drupal.ajax';
    }
    BubbleableMetadata::createFromRenderArray($element)
      ->merge(BubbleableMetadata::createFromRenderArray($build_for_bubbleable_metadata))
      ->applyTo($element);
    return $element;
  }

  /**
   * Set default options.
   */
  protected function defineOptions() {
    $options = parent::defineOptions();
    $options['data_source_lat'] = [
      'default' => '',
    ];
    $options['data_source_lon'] = [
      'default' => '',
    ];
    $options['entity_source'] = [
      'default' => '__base_table',
    ];
    $options['name_field'] = [
      'default' => '',
    ];
    $options['description_field'] = [
      'default' => '',
    ];
    $options['view_mode'] = [
      'default' => 'full',
    ];
    $leaflet_map_default_settings = [];
    foreach (self::getDefaultSettings() as $k => $setting) {
      $leaflet_map_default_settings[$k] = [
        'default' => $setting,
      ];
    }
    return $options + $leaflet_map_default_settings;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CivicrmEntityAddressLeafletMap::buildOptionsForm public function Provide a form to edit options for this plugin. Overrides LeafletMap::buildOptionsForm
CivicrmEntityAddressLeafletMap::defineOptions protected function Set default options. Overrides LeafletMap::defineOptions
CivicrmEntityAddressLeafletMap::getAvailableDataSources protected function Get a list of fields and a sublist of geo data fields in this view. Overrides LeafletMap::getAvailableDataSources
CivicrmEntityAddressLeafletMap::render public function Renders the View. Overrides LeafletMap::render
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
LeafletMap::$currentUser protected property Current user service.
LeafletMap::$defaultSettings protected property The Default Settings.
LeafletMap::$entityDisplay protected property The Entity Display Repository service property.
LeafletMap::$entityFieldManager protected property The Entity Field manager service property.
LeafletMap::$entityInfo protected property The Entity Info service property.
LeafletMap::$entityManager protected property The Entity type manager service.
LeafletMap::$entitySource protected property The Entity source property.
LeafletMap::$entityType protected property The Entity type property.
LeafletMap::$fieldTypeManager protected property Field type plugin manager.
LeafletMap::$leafletService protected property Leaflet service.
LeafletMap::$link protected property The Link generator Service.
LeafletMap::$messenger protected property The messenger. Overrides MessengerTrait::$messenger
LeafletMap::$moduleHandler protected property The module handler to invoke the alter hook.
LeafletMap::$renderer protected property The Renderer service property. Overrides PluginBase::$renderer
LeafletMap::$usesFields protected property Does the style plugin for itself support to add fields to its output. Overrides StylePluginBase::$usesFields
LeafletMap::$usesRowPlugin protected property Whether or not this style uses a row plugin. Overrides StylePluginBase::$usesRowPlugin
LeafletMap::$viewFields protected property The list of fields added to the view.
LeafletMap::create public static function Creates an instance of the plugin. Overrides PluginBase::create
LeafletMap::evenEmpty public function Should the output of the style plugin be rendered even if it's a empty view. Overrides StylePluginBase::evenEmpty
LeafletMap::getAvailableEntitySources protected function Get options for the available entity sources.
LeafletMap::getEntitySourceEntityInfo protected function Get the entity info of the entity source.
LeafletMap::getFieldValue public function Get the raw field value. Overrides StylePluginBase::getFieldValue
LeafletMap::init public function Overrides \Drupal\views\Plugin\views\PluginBase::init(). Overrides StylePluginBase::init
LeafletMap::optionsFormEntitySourceSubmit public static function Submit to update the data source.
LeafletMap::optionsFormEntitySourceSubmitAjax public static function Ajax callback to reload the options form after data source change.
LeafletMap::validateOptionsForm public function Validate the options form. Overrides StylePluginBase::validateOptionsForm
LeafletMap::__construct public function Constructs a LeafletMap style instance. Overrides PluginBase::__construct
LeafletSettingsElementsTrait::$controlPositionsOptions protected property Leaflet Controls Positions Options.
LeafletSettingsElementsTrait::$leafletCircleRadiusFieldTypesOptions protected property Leaflet Circle Radius Marker Field Types Options.
LeafletSettingsElementsTrait::generateIconFormElement protected function Generate the Leaflet Icon Form Element.
LeafletSettingsElementsTrait::generateMapGeneralSettings protected function Generate the Leaflet Map General Settings.
LeafletSettingsElementsTrait::generateMapPositionElement protected function Generate the Leaflet Map Position Form Element.
LeafletSettingsElementsTrait::getDefaultSettings public static function Get the Default Settings.
LeafletSettingsElementsTrait::jsonValidate public static function Form element json format validation handler.
LeafletSettingsElementsTrait::maxZoomLevelValidate public static function Form element validation handler for the Map Max Zoom level.
LeafletSettingsElementsTrait::setAdditionalMapOptions protected function Set Map additional map Settings.
LeafletSettingsElementsTrait::setGeocoderMapControl protected function Set Map Geocoder Control Element.
LeafletSettingsElementsTrait::setMapMarkerclusterElement protected function Set Map MarkerCluster Element.
LeafletSettingsElementsTrait::setMapPathOptionsElement protected function Set Map Geometries Options Element.
LeafletSettingsElementsTrait::setResetMapControl protected function Set Map MarkerCluster Element.
LeafletSettingsElementsTrait::validateGeocoderProviders public static function Validates the Geocoder Providers element.
LeafletSettingsElementsTrait::zoomLevelValidate public static function Form element validation handler for a Map Zoom level.
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$definition public property Plugins's definition
PluginBase::$displayHandler public property The display object this plugin is for.
PluginBase::$options public property Options for this plugin will be held here.
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::$view public property The top object of a view. 1
PluginBase::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies 14
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::doFilterByDefinedOptions protected function Do the work to filter out stored options depending on the defined options.
PluginBase::filterByDefinedOptions public function Filter out stored options depending on the defined options. Overrides ViewsPluginInterface::filterByDefinedOptions
PluginBase::getAvailableGlobalTokens public function Returns an array of available token replacements. Overrides ViewsPluginInterface::getAvailableGlobalTokens
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::getProvider public function Returns the plugin provider. Overrides ViewsPluginInterface::getProvider
PluginBase::getRenderer protected function Returns the render API renderer. 1
PluginBase::globalTokenForm public function Adds elements for available core tokens to a form. Overrides ViewsPluginInterface::globalTokenForm
PluginBase::globalTokenReplace public function Returns a string with any core tokens replaced. Overrides ViewsPluginInterface::globalTokenReplace
PluginBase::INCLUDE_ENTITY constant Include entity row languages when listing languages.
PluginBase::INCLUDE_NEGOTIATED constant Include negotiated languages when listing languages.
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::listLanguages protected function Makes an array of languages, optionally including special languages.
PluginBase::pluginTitle public function Return the human readable name of the display. Overrides ViewsPluginInterface::pluginTitle
PluginBase::preRenderAddFieldsetMarkup public static function Moves form elements into fieldsets for presentation purposes. Overrides ViewsPluginInterface::preRenderAddFieldsetMarkup
PluginBase::preRenderFlattenData public static function Flattens the structure of form elements. Overrides ViewsPluginInterface::preRenderFlattenData
PluginBase::queryLanguageSubstitutions public static function Returns substitutions for Views queries for languages.
PluginBase::setOptionDefaults protected function Fills up the options of the plugin with defaults.
PluginBase::submitOptionsForm public function Handle any special handling on the validate form. Overrides ViewsPluginInterface::submitOptionsForm 16
PluginBase::summaryTitle public function Returns the summary of the settings in the display. Overrides ViewsPluginInterface::summaryTitle 6
PluginBase::themeFunctions public function Provide a full list of possible theme templates used by this style. Overrides ViewsPluginInterface::themeFunctions 1
PluginBase::unpackOptions public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. Overrides ViewsPluginInterface::unpackOptions
PluginBase::usesOptions public function Returns the usesOptions property. Overrides ViewsPluginInterface::usesOptions 8
PluginBase::viewsTokenReplace protected function Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin. 1
PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT constant Query string to indicate the site default language.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
StylePluginBase::$defaultFieldLabels protected property Should field labels be enabled by default. 1
StylePluginBase::$groupingTheme protected property The theme function used to render the grouping set.
StylePluginBase::$rendered_fields protected property Stores the rendered field values, keyed by the row index and field name.
StylePluginBase::$rowTokens protected property Store all available tokens row rows.
StylePluginBase::$usesGrouping protected property Does the style plugin support grouping of rows. 3
StylePluginBase::$usesOptions protected property Denotes whether the plugin has an additional options form. Overrides PluginBase::$usesOptions
StylePluginBase::$usesRowClass protected property Does the style plugin support custom css class for the rows. 3
StylePluginBase::buildSort public function Called by the view builder to see if this style handler wants to interfere with the sorts. If so it should build; if it returns any non-TRUE value, normal sorting will NOT be added to the query. 1
StylePluginBase::buildSortPost public function Called by the view builder to let the style build a second set of sorts that will come after any other sorts in the view. 1
StylePluginBase::defaultFieldLabels public function Return TRUE if this style enables field labels by default. 1
StylePluginBase::destroy public function Clears a plugin. Overrides PluginBase::destroy
StylePluginBase::elementPreRenderRow public function #pre_render callback for view row field rendering.
StylePluginBase::getField public function Gets a rendered field.
StylePluginBase::getRowClass public function Return the token replaced row class for the specified row.
StylePluginBase::preRender public function Allow the style to do stuff before each row is rendered.
StylePluginBase::query public function Add anything to the query that we might need to. Overrides PluginBase::query 1
StylePluginBase::renderFields protected function Renders all of the fields for a given style and store them on the object.
StylePluginBase::renderGrouping public function Group records as needed for rendering.
StylePluginBase::renderGroupingSets public function Render the grouping sets.
StylePluginBase::renderRowGroup protected function Renders a group of rows of the grouped view.
StylePluginBase::tokenizeValue public function Take a value and apply token replacement logic to it.
StylePluginBase::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides PluginBase::trustedCallbacks
StylePluginBase::usesFields public function Return TRUE if this style also uses fields. 3
StylePluginBase::usesGrouping public function Returns the usesGrouping property. 3
StylePluginBase::usesRowClass public function Returns the usesRowClass property. 3
StylePluginBase::usesRowPlugin public function Returns the usesRowPlugin property. 10
StylePluginBase::usesTokens public function Return TRUE if this style uses tokens.
StylePluginBase::validate public function Validate that the plugin is correct and can be saved. Overrides PluginBase::validate
StylePluginBase::wizardForm public function Provide a form in the views wizard if this style is selected.
StylePluginBase::wizardSubmit public function Alter the options of a display before they are added to the view. 1
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.