annotate core/modules/workflows/src/WorkflowDeleteAccessCheck.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\workflows;
Chris@0 4
Chris@0 5 use Drupal\Core\Routing\RouteMatchInterface;
Chris@0 6 use Drupal\Core\Session\AccountInterface;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Provides a access checker for deleting a workflow state.
Chris@0 10 *
Chris@0 11 * @internal
Chris@18 12 * Marked as internal for use by the workflows module only.
Chris@18 13 *
Chris@18 14 * @deprecated
Chris@18 15 * Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0
Chris@18 16 * and will be removed before Drupal 9.0.0, you can use _workflow_access in
Chris@18 17 * route definitions instead.
Chris@18 18 * @code
Chris@18 19 * # The old approach:
Chris@18 20 * requirements:
Chris@18 21 * _workflow_state_delete_access: 'true'
Chris@18 22 * # The new approach:
Chris@18 23 * requirements:
Chris@18 24 * _workflow_access: 'delete-state'
Chris@18 25 * @endcode
Chris@18 26 * As an internal API the ability to use _workflow_state_delete_access may
Chris@18 27 * also be removed in a minor release.
Chris@18 28 *
Chris@18 29 * @see \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck
Chris@18 30 * @see https://www.drupal.org/node/2929327
Chris@0 31 */
Chris@18 32 class WorkflowDeleteAccessCheck extends WorkflowStateTransitionOperationsAccessCheck {
Chris@0 33
Chris@0 34 /**
Chris@18 35 * {@inheritdoc}
Chris@0 36 */
Chris@18 37 public function access(RouteMatchInterface $route_match, AccountInterface $account) {
Chris@18 38 @trigger_error('Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0, use _workflow_access instead. As an internal API _workflow_state_delete_access may also be removed in a minor release.', E_USER_DEPRECATED);
Chris@18 39 return parent::access($route_match, $account);
Chris@18 40 }
Chris@18 41
Chris@18 42 /**
Chris@18 43 * {@inheritdoc}
Chris@18 44 */
Chris@18 45 protected function getOperation(RouteMatchInterface $route_match) {
Chris@18 46 return 'delete-state';
Chris@0 47 }
Chris@0 48
Chris@0 49 }