You are here

protected function ViewsConfigUpdater::processEntityLinkUrlHandler in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processEntityLinkUrlHandler()

Processes entity link URL fields.

Parameters

array $handler: A display handler.

string $handler_type: The handler type.

Return value

bool Whether the handler was updated.

2 calls to ViewsConfigUpdater::processEntityLinkUrlHandler()
ViewsConfigUpdater::needsEntityLinkUrlUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add additional settings to the entity link field.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

core/modules/views/src/ViewsConfigUpdater.php, line 188

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

protected function processEntityLinkUrlHandler(array &$handler, $handler_type) {
  $changed = FALSE;
  if ($handler_type === 'field') {
    if (isset($handler['plugin_id']) && $handler['plugin_id'] === 'entity_link') {

      // Add any missing settings for entity_link.
      if (!isset($handler['output_url_as_text'])) {
        $handler['output_url_as_text'] = FALSE;
        $changed = TRUE;
      }
      if (!isset($handler['absolute'])) {
        $handler['absolute'] = FALSE;
        $changed = TRUE;
      }
    }
    elseif (isset($handler['plugin_id']) && $handler['plugin_id'] === 'node_path') {

      // Convert the use of node_path to entity_link.
      $handler['plugin_id'] = 'entity_link';
      $handler['field'] = 'view_node';
      $handler['output_url_as_text'] = TRUE;
      $changed = TRUE;
    }
  }
  return $changed;
}