You are here

public function PageRedirect::alterExtraFields in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/RabbitHoleBehaviorPlugin/PageRedirect.php \Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPlugin\PageRedirect::alterExtraFields()

Add to or adjust the fields added by rabbit hole.

Parameters

array $fields: The array of fields to be altered.

Overrides RabbitHoleBehaviorPluginBase::alterExtraFields

File

src/Plugin/RabbitHoleBehaviorPlugin/PageRedirect.php, line 413

Class

PageRedirect
Redirects to another page.

Namespace

Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPlugin

Code

public function alterExtraFields(array &$fields) {
  $fields['rh_redirect'] = BaseFieldDefinition::create('string')
    ->setName('rh_redirect')
    ->setLabel($this
    ->t('Rabbit Hole redirect path.'))
    ->setDescription($this
    ->t('The path to where the user should get redirected to.'));
  $fields['rh_redirect_response'] = BaseFieldDefinition::create('integer')
    ->setName('rh_redirect_response')
    ->setLabel($this
    ->t('Rabbit Hole redirect response code'))
    ->setDescription($this
    ->t('Specifies the HTTP response code that should be used when perform a redirect.'));
  $fields['rh_redirect_fallback_action'] = BaseFieldDefinition::create('string')
    ->setName('rh_redirect_fallback_action')
    ->setLabel($this
    ->t('Rabbit Hole redirect fallback action'))
    ->setDescription($this
    ->t('Specifies the action that should be used when the redirect path is invalid or empty.'));
}