public function BehaviorSettings::setRedirectCode in Rabbit Hole 8
Same name and namespace in other branches
- 2.x src/Entity/BehaviorSettings.php \Drupal\rabbit_hole\Entity\BehaviorSettings::setRedirectCode()
@todo Possibly this should instead rely on the redirect plugin?
Overrides BehaviorSettingsInterface::setRedirectCode
File
- src/
Entity/ BehaviorSettings.php, line 144
Class
- BehaviorSettings
- Defines the Behavior settings entity.
Namespace
Drupal\rabbit_hole\EntityCode
public function setRedirectCode($redirect_code) {
if (!in_array($redirect_code, [
self::REDIRECT_NOT_APPLICABLE,
self::REDIRECT_MOVED_PERMANENTLY,
self::REDIRECT_FOUND,
self::REDIRECT_SEE_OTHER,
self::REDIRECT_NOT_MODIFIED,
self::REDIRECT_USE_PROXY,
self::REDIRECT_TEMPORARY_REDIRECT,
])) {
throw new InvalidBehaviorSettingException('redirect_code');
}
if ($this->action !== 'redirect' && $redirect_code !== self::REDIRECT_NOT_APPLICABLE) {
throw new InvalidBehaviorSettingException('redirect_code');
}
$this->redirect_code = $redirect_code;
}