function ViewsConfigUpdater::processEntityLinkUrlHandler

Same name and namespace in other branches
  1. 8.9.x 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.

\Drupal\views\ViewEntityInterface $view: The View being updated.

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 226

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

protected function processEntityLinkUrlHandler(array &$handler, $handler_type, ViewEntityInterface $view) {
    $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;
        }
    }
    $deprecations_triggered =& $this->triggeredDeprecations['2857891'][$view->id()];
    if ($this->deprecationsEnabled && $changed && !$deprecations_triggered) {
        $deprecations_triggered = TRUE;
        @trigger_error(sprintf('The entity link url update for the "%s" view is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Module-provided Views configuration should be updated to accommodate the changes described at https://www.drupal.org/node/2857891.', $view->id()), E_USER_DEPRECATED);
    }
    return $changed;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.