Redirects to a different URL.
@Action(
id = "action_goto_action",
label = @Translation("Redirect to URL"),
type = "system"
)
Expanded class hierarchy of GotoAction
class GotoAction extends ConfigurableActionBase {
/**
* {@inheritdoc}
*/
public function execute($object = NULL) {
drupal_goto($this->configuration['url']);
}
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
return array(
'url' => '',
);
}
/**
* {@inheritdoc}
*/
public function form(array $form, array &$form_state) {
$form['url'] = array(
'#type' => 'textfield',
'#title' => t('URL'),
'#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like @url.', array(
'@url' => 'http://drupal.org',
)),
'#default_value' => $this->configuration['url'],
'#required' => TRUE,
);
return $form;
}
/**
* {@inheritdoc}
*/
public function submit(array &$form, array &$form_state) {
$this->configuration['url'] = $form_state['values']['url'];
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ActionBase:: |
public | function |
Executes the plugin for an array of objects. Overrides ActionInterface:: |
2 |
ConfigurableActionBase:: |
public | function |
Returns this plugin's configuration. Overrides ConfigurableActionInterface:: |
|
ConfigurableActionBase:: |
public | function |
Form validation handler. Overrides ConfigurableActionInterface:: |
2 |
ConfigurableActionBase:: |
public | function |
Constructs a Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
3 |
ContainerFactoryPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
11 |
GotoAction:: |
public | function |
Executes the plugin. Overrides ExecutableInterface:: |
|
GotoAction:: |
public | function |
Form constructor. Overrides ConfigurableActionInterface:: |
|
GotoAction:: |
protected | function |
Returns default configuration for this action. Overrides ConfigurableActionBase:: |
|
GotoAction:: |
public | function |
Form submission handler. Overrides ConfigurableActionInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
public | function |
Returns the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |