class ViewsConfigUpdater implements ContainerInjectionInterface (View source)

internal  This class is only meant to fix outdated views configuration and its methods should not be invoked directly. It will be removed once all the deprecated methods have been removed.
 

Provides a BC layer for modules providing old configurations.

Properties

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

protected EntityFieldManagerInterface $entityFieldManager

The entity field manager.

protected TypedConfigManagerInterface $typedConfigManager

The typed config manager.

protected ViewsData $viewsData

The views data service.

protected array $multivalueBaseFieldsUpdateTableInfo

An array of helper data for the multivalue base field update.

protected bool $deprecationsEnabled

Flag determining whether deprecations should be triggered.

protected bool $triggeredDeprecations

Stores which deprecations were triggered.

Methods

__construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, TypedConfigManagerInterface $typed_config_manager, ViewsData $views_data)

ViewsConfigUpdater constructor.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

setDeprecationsEnabled(bool $enabled)

Sets the deprecations enabling status.

bool
updateAll(ViewEntityInterface $view)

Performs all required updates.

bool
processDisplayHandlers(ViewEntityInterface $view, bool $return_on_changed, callable $handler_processor)

Processes all display handlers.

bool
needsEntityLinkUrlUpdate(ViewEntityInterface $view) deprecated

Add additional settings to the entity link field.

bool
processEntityLinkUrlHandler(array $handler, string $handler_type, ViewEntityInterface $view)

Processes entity link URL fields.

bool
needsOperatorDefaultsUpdate(ViewEntityInterface $view) deprecated

Add additional settings to the entity link field.

bool
processOperatorDefaultsHandler(array $handler, string $handler_type, ViewEntityInterface $view)

Processes operator defaults.

bool
needsMultivalueBaseFieldUpdate(ViewEntityInterface $view) deprecated

Update field names for multi-value base fields.

array
getMultivalueBaseFieldUpdateTableInfo()

Returns the multivalue base fields update table info.

bool
processMultivalueBaseFieldHandler(array $handler, string $handler_type, string $key, string $display_id, ViewEntityInterface $view)

Processes handlers affected by the multivalue base field update.

string
mapOperatorFromSingleToMultiple(string $single_operator)

Maps a single operator to a multiple one, if possible.

bool
needsSortFieldIdentifierUpdate(ViewEntityInterface $view)

Updates the sort handlers by adding default sort field identifiers.

bool
processSortFieldIdentifierUpdateHandler(array $handler, string $handler_type)

Processes sort handlers by adding the sort identifier.

Details

__construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, TypedConfigManagerInterface $typed_config_manager, ViewsData $views_data)

ViewsConfigUpdater constructor.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

EntityFieldManagerInterface $entity_field_manager

The entity field manager.

TypedConfigManagerInterface $typed_config_manager

The typed config manager.

ViewsData $views_data

The views data service.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

setDeprecationsEnabled(bool $enabled)

Sets the deprecations enabling status.

Parameters

bool $enabled

Whether deprecations should be enabled.

bool updateAll(ViewEntityInterface $view)

Performs all required updates.

Parameters

ViewEntityInterface $view

The View to update.

Return Value

bool

Whether the view was updated.

protected bool processDisplayHandlers(ViewEntityInterface $view, bool $return_on_changed, callable $handler_processor)

Processes all display handlers.

Parameters

ViewEntityInterface $view

The View to update.

bool $return_on_changed

Whether processing should stop after a change is detected.

callable $handler_processor

A callback performing the actual update.

Return Value

bool

Whether the view was updated.

bool needsEntityLinkUrlUpdate(ViewEntityInterface $view) deprecated

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 below.

Add additional settings to the entity link field.

Parameters

ViewEntityInterface $view

The View to update.

Return Value

bool

Whether the view was updated.

See also

https://www.drupal.org/node/2857891

protected bool processEntityLinkUrlHandler(array $handler, string $handler_type, ViewEntityInterface $view)

Processes entity link URL fields.

Parameters

array $handler

A display handler.

string $handler_type

The handler type.

ViewEntityInterface $view

The View being updated.

Return Value

bool

Whether the handler was updated.

bool needsOperatorDefaultsUpdate(ViewEntityInterface $view) deprecated

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 below.

Add additional settings to the entity link field.

Parameters

ViewEntityInterface $view

The View to update.

Return Value

bool

Whether the view was updated.

See also

https://www.drupal.org/node/2869168

protected bool processOperatorDefaultsHandler(array $handler, string $handler_type, ViewEntityInterface $view)

Processes operator defaults.

Parameters

array $handler

A display handler.

string $handler_type

The handler type.

ViewEntityInterface $view

The View being updated.

Return Value

bool

Whether the handler was updated.

bool needsMultivalueBaseFieldUpdate(ViewEntityInterface $view) deprecated

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 below.

Update field names for multi-value base fields.

Parameters

ViewEntityInterface $view

The View to update.

Return Value

bool

Whether the view was updated.

See also

https://www.drupal.org/node/2900684

protected array getMultivalueBaseFieldUpdateTableInfo()

Returns the multivalue base fields update table info.

Return Value

array

An array of multivalue base field info.

protected bool processMultivalueBaseFieldHandler(array $handler, string $handler_type, string $key, string $display_id, ViewEntityInterface $view)

Processes handlers affected by the multivalue base field update.

Parameters

array $handler

A display handler.

string $handler_type

The handler type.

string $key

The handler key.

string $display_id

The handler display ID.

ViewEntityInterface $view

The view being updated.

Return Value

bool

Whether the handler was updated.

protected string mapOperatorFromSingleToMultiple(string $single_operator)

Maps a single operator to a multiple one, if possible.

Parameters

string $single_operator

A single operator.

Return Value

string

A multiple operator or the original one if no mapping was available.

bool needsSortFieldIdentifierUpdate(ViewEntityInterface $view)

Updates the sort handlers by adding default sort field identifiers.

Parameters

ViewEntityInterface $view

The View to update.

Return Value

bool

Whether the view was updated.

protected bool processSortFieldIdentifierUpdateHandler(array $handler, string $handler_type)

Processes sort handlers by adding the sort identifier.

Parameters

array $handler

A display handler.

string $handler_type

The handler type.

Return Value

bool

Whether the handler was updated.