You are here

class EntityRevisionConverter in Drupal 8

Defines a class for making sure the edit-route loads the current draft.

@internal This class only exists to provide backwards compatibility with the load_pending_revision flag, the predecessor to load_latest_revision. The core entity converter now natively loads the latest revision of an entity when the load_latest_revision flag is present. This flag is also added automatically to all entity forms.

Hierarchy

Expanded class hierarchy of EntityRevisionConverter

1 string reference to 'EntityRevisionConverter'
content_moderation.services.yml in core/modules/content_moderation/content_moderation.services.yml
core/modules/content_moderation/content_moderation.services.yml
1 service uses EntityRevisionConverter
paramconverter.latest_revision in core/modules/content_moderation/content_moderation.services.yml
Drupal\content_moderation\ParamConverter\EntityRevisionConverter

File

core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php, line 17

Namespace

Drupal\content_moderation\ParamConverter
View source
class EntityRevisionConverter extends EntityConverter {

  /**
   * {@inheritdoc}
   */
  public function convert($value, $definition, $name, array $defaults) {
    if (!empty($definition['load_pending_revision'])) {
      @trigger_error('The load_pending_revision flag has been deprecated. You should use load_latest_revision instead.', E_USER_DEPRECATED);
      $definition['load_latest_revision'] = TRUE;
    }
    return parent::convert($value, $definition, $name, $defaults);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeprecatedServicePropertyTrait::__get public function Allows to access deprecated/removed properties.
DynamicEntityTypeParamConverterTrait::getEntityTypeFromDefaults protected function Determines the entity type ID given a route definition and route defaults.
EntityConverter::$deprecatedProperties protected property
EntityConverter::$entityRepository protected property Entity repository.
EntityConverter::$entityTypeManager protected property Entity type manager which performs the upcasting in the end.
EntityConverter::applies public function Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface::applies 2
EntityConverter::getLatestTranslationAffectedRevision Deprecated protected function Returns the latest revision translation of the specified entity.
EntityConverter::languageManager protected function Returns a language manager instance.
EntityConverter::loadRevision Deprecated protected function Loads the specified entity revision.
EntityConverter::__construct public function Constructs a new EntityConverter. 1
EntityRevisionConverter::convert public function Converts path variables to their corresponding objects. Overrides EntityConverter::convert