Mercurial > hg > isophonics-drupal-site
annotate core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 1fec387a4317 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\content_moderation\ParamConverter; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\ParamConverter\EntityConverter; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Defines a class for making sure the edit-route loads the current draft. |
Chris@14 | 9 * |
Chris@14 | 10 * @internal |
Chris@14 | 11 * This class only exists to provide backwards compatibility with the |
Chris@14 | 12 * load_pending_revision flag, the predecessor to load_latest_revision. The |
Chris@14 | 13 * core entity converter now natively loads the latest revision of an entity |
Chris@14 | 14 * when the load_latest_revision flag is present. This flag is also added |
Chris@14 | 15 * automatically to all entity forms. |
Chris@0 | 16 */ |
Chris@0 | 17 class EntityRevisionConverter extends EntityConverter { |
Chris@0 | 18 |
Chris@0 | 19 /** |
Chris@0 | 20 * {@inheritdoc} |
Chris@0 | 21 */ |
Chris@0 | 22 public function convert($value, $definition, $name, array $defaults) { |
Chris@14 | 23 if (!empty($definition['load_pending_revision'])) { |
Chris@14 | 24 @trigger_error('The load_pending_revision flag has been deprecated. You should use load_latest_revision instead.', E_USER_DEPRECATED); |
Chris@14 | 25 $definition['load_latest_revision'] = TRUE; |
Chris@0 | 26 } |
Chris@14 | 27 return parent::convert($value, $definition, $name, $defaults); |
Chris@0 | 28 } |
Chris@0 | 29 |
Chris@0 | 30 } |