You are here

function hook_rabbit_hole_values_alter in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 rabbit_hole.api.php \hook_rabbit_hole_values_alter()

Alter rabbit hole values before the Rabbit Hole plugin is loaded.

Parameters

array $values: The current Rabbit Hole values array.

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to apply rabbit hole behavior on.

1 invocation of hook_rabbit_hole_values_alter()
BehaviorInvoker::getBehaviorPlugin in src/BehaviorInvoker.php
Get the behavior plugin for the given entity.

File

./rabbit_hole.api.php, line 20
Hooks provided by the Rabbit Hole module.

Code

function hook_rabbit_hole_values_alter(array &$values, \Drupal\Core\Entity\ContentEntityInterface $entity) {

  // Disable bypassing access for everyone (including administrators).
  $values['bypass_access'] = FALSE;

  // Change action for some special cases.
  if ($entity
    ->isTranslatable() && $values['rh_action'] === 'access_denied') {
    $values['rh_action'] = 'display_page';
  }
}