annotate core/modules/workflows/src/WorkflowDeleteAccessCheck.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
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@5 12 * Marked as internal for use by the workflows module only.
Chris@5 13 *
Chris@5 14 * @deprecated
Chris@5 15 * Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0
Chris@5 16 * and will be removed before Drupal 9.0.0, you can use _workflow_access in
Chris@5 17 * route definitions instead.
Chris@5 18 * @code
Chris@5 19 * # The old approach:
Chris@5 20 * requirements:
Chris@5 21 * _workflow_state_delete_access: 'true'
Chris@5 22 * # The new approach:
Chris@5 23 * requirements:
Chris@5 24 * _workflow_access: 'delete-state'
Chris@5 25 * @endcode
Chris@5 26 * As an internal API the ability to use _workflow_state_delete_access may
Chris@5 27 * also be removed in a minor release.
Chris@5 28 *
Chris@5 29 * @see \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck
Chris@5 30 * @see https://www.drupal.org/node/2929327
Chris@0 31 */
Chris@5 32 class WorkflowDeleteAccessCheck extends WorkflowStateTransitionOperationsAccessCheck {
Chris@0 33
Chris@0 34 /**
Chris@5 35 * {@inheritdoc}
Chris@0 36 */
Chris@5 37 public function access(RouteMatchInterface $route_match, AccountInterface $account) {
Chris@5 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@5 39 return parent::access($route_match, $account);
Chris@5 40 }
Chris@5 41
Chris@5 42 /**
Chris@5 43 * {@inheritdoc}
Chris@5 44 */
Chris@5 45 protected function getOperation(RouteMatchInterface $route_match) {
Chris@5 46 return 'delete-state';
Chris@0 47 }
Chris@0 48
Chris@0 49 }