public function PageRedirect::getActionResponseCode in Rabbit Hole 8
Same name and namespace in other branches
- 2.x src/Plugin/RabbitHoleBehaviorPlugin/PageRedirect.php \Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPlugin\PageRedirect::getActionResponseCode()
Returns the action response code.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the action is being performed on.
Return value
int Redirect code.
1 call to PageRedirect::getActionResponseCode()
- PageRedirect::performAction in src/
Plugin/ RabbitHoleBehaviorPlugin/ PageRedirect.php - Perform the rabbit hole action.
File
- src/
Plugin/ RabbitHoleBehaviorPlugin/ PageRedirect.php, line 244
Class
- PageRedirect
- Redirects to another page.
Namespace
Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginCode
public function getActionResponseCode(EntityInterface $entity) {
$target = $entity
->get('rh_redirect')->value;
if (empty($target)) {
$bundle_settings = $this
->getBundleSettings($entity);
$response_code = $bundle_settings
->get('redirect_code');
$this->cacheMetadata
->addCacheableDependency($bundle_settings);
}
else {
$response_code = $entity
->get('rh_redirect_response')->value;
}
return $response_code;
}