Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -5,6 +5,11 @@
|
|||
* Hooks provided by the Actions module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup hooks
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes code after an action is deleted.
|
||||
*
|
||||
|
@ -16,3 +21,7 @@ function hook_action_delete($aid) {
|
|||
->condition('aid', $aid)
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
action.admin:
|
||||
title: Actions
|
||||
description: 'Manage the actions defined for your site.'
|
||||
description: 'Create tasks that the system can execute.'
|
||||
route_name: entity.action.collection
|
||||
parent: system.admin_config_system
|
||||
|
|
|
@ -15,13 +15,13 @@ function action_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.action':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Actions module provides tasks that can be executed by the site such as unpublishing content, sending email messages, or blocking a user. Other modules can trigger these actions when specific system events happen; for example, when new content is posted or when a user logs in. Modules can also provide additional actions. For more information, see the <a href="!documentation">online documentation for the Action module</a>.', array('!documentation' => 'https://www.drupal.org/documentation/modules/action')) . '</p>';
|
||||
$output .= '<p>' . t('The Actions module provides tasks that can be executed by the site such as unpublishing content, sending email messages, or blocking a user. Other modules can trigger these actions when specific system events happen; for example, when new content is posted or when a user logs in. Modules can also provide additional actions. For more information, see the <a href=":documentation">online documentation for the Actions module</a>.', array(':documentation' => 'https://www.drupal.org/documentation/modules/action')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Using simple actions') . '</dt>';
|
||||
$output .= '<dd>' . t('<em>Simple actions</em> do not require configuration and are listed automatically as available on the <a href="!actions">Actions page</a>.', array('!actions' => \Drupal::url('entity.action.collection'))) . '</dd>';
|
||||
$output .= '<dd>' . t('<em>Simple actions</em> do not require configuration and are listed automatically as available on the <a href=":actions">Actions page</a>.', array(':actions' => \Drupal::url('entity.action.collection'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Creating and configuring advanced actions') . '</dt>';
|
||||
$output .= '<dd>' . t('<em>Advanced actions</em> are user-created and have to be configured individually. Create an advanced action on the <a href="!actions">Actions page</a> by selecting an action type from the drop-down list. Then configure your action, for example by specifying the recipient of an automated email message.', array('!actions' => \Drupal::url('entity.action.collection'))) . '</dd>';
|
||||
$output .= '<dd>' . t('<em>Advanced actions</em> are user-created and have to be configured individually. Create an advanced action on the <a href=":actions">Actions page</a> by selecting an action type from the drop-down list. Then configure your action, for example by specifying the recipient of an automated email message.', array(':actions' => \Drupal::url('entity.action.collection'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
id: d6_action_settings
|
||||
label: Drupal 6 action configuration
|
||||
label: Action configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\action\Plugin\Action;
|
||||
|
||||
use Drupal\Component\Render\PlainTextOutput;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\Core\Action\ConfigurableActionBase;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
@ -127,7 +128,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
|
|||
$this->configuration['node'] = $entity;
|
||||
}
|
||||
|
||||
$recipient = $this->token->replace($this->configuration['recipient'], $this->configuration);
|
||||
$recipient = PlainTextOutput::renderFromHtml($this->token->replace($this->configuration['recipient'], $this->configuration));
|
||||
|
||||
// If the recipient is a registered user with a language preference, use
|
||||
// the recipient's preferred language. Otherwise, use the system default
|
||||
|
@ -185,7 +186,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
|
|||
'#default_value' => $this->configuration['message'],
|
||||
'#cols' => '80',
|
||||
'#rows' => '20',
|
||||
'#description' => t('The message that should be sent. You may include placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
|
||||
'#description' => t('The message that should be sent. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
namespace Drupal\action\Plugin\Action;
|
||||
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\Core\Action\ConfigurableActionBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Utility\UnroutedUrlAssemblerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
@ -37,11 +38,11 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
|
|||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* The url generator service.
|
||||
* The unrouted URL assembler service.
|
||||
*
|
||||
* @var \Drupal\Core\Routing\UrlGeneratorInterface
|
||||
* @var \Drupal\Core\Utility\UnroutedUrlAssemblerInterface
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
protected $unroutedUrlAssembler;
|
||||
|
||||
/**
|
||||
* Constructs a new DeleteNode object.
|
||||
|
@ -54,29 +55,47 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
|
|||
* The plugin implementation definition.
|
||||
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
|
||||
* The tempstore factory.
|
||||
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
|
||||
* The url generator service.
|
||||
* @param \Drupal\Core\Utility\UnroutedUrlAssemblerInterface $url_assembler
|
||||
* The unrouted URL assembler service.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EventDispatcherInterface $dispatcher, UrlGeneratorInterface $url_generator) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EventDispatcherInterface $dispatcher, UnroutedUrlAssemblerInterface $url_assembler) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->urlGenerator = $url_generator;
|
||||
$this->unroutedUrlAssembler = $url_assembler;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static($configuration, $plugin_id, $plugin_definition, $container->get('event_dispatcher'), $container->get('url_generator'));
|
||||
return new static($configuration, $plugin_id, $plugin_definition, $container->get('event_dispatcher'), $container->get('unrouted_url_assembler'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($object = NULL) {
|
||||
$url = $this->urlGenerator
|
||||
->generateFromPath($this->configuration['url'], array('absolute' => TRUE));
|
||||
$url = $this->configuration['url'];
|
||||
// Leave external URLs unchanged, and assemble others as absolute URLs
|
||||
// relative to the site's base URL.
|
||||
if (!UrlHelper::isExternal($url)) {
|
||||
$parts = UrlHelper::parse($url);
|
||||
// @todo '<front>' is valid input for BC reasons, may be removed by
|
||||
// https://www.drupal.org/node/2421941
|
||||
if ($parts['path'] === '<front>') {
|
||||
$parts['path'] = '';
|
||||
}
|
||||
$uri = 'base:' . $parts['path'];
|
||||
$options = [
|
||||
'query' => $parts['query'],
|
||||
'fragment' => $parts['fragment'],
|
||||
'absolute' => TRUE,
|
||||
];
|
||||
// Treat this as if it's user input of a path relative to the site's
|
||||
// base URL.
|
||||
$url = $this->unroutedUrlAssembler->assemble($uri, $options);
|
||||
}
|
||||
$response = new RedirectResponse($url);
|
||||
$listener = function($event) use ($response) {
|
||||
$event->setResponse($response);
|
||||
|
@ -101,7 +120,7 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
|
|||
$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://example.com')),
|
||||
'#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://example.com')),
|
||||
'#default_value' => $this->configuration['url'],
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
namespace Drupal\action\Plugin\Action;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\Core\Action\ConfigurableActionBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Utility\Token;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -33,19 +33,40 @@ class MessageAction extends ConfigurableActionBase implements ContainerFactoryPl
|
|||
protected $token;
|
||||
|
||||
/**
|
||||
* Constructs a MessageAction object.
|
||||
* The renderer.
|
||||
*
|
||||
* @var \Drupal\Core\Render\RendererInterface
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, Token $token) {
|
||||
protected $renderer;
|
||||
|
||||
/**
|
||||
* Constructs a MessageAction object.
|
||||
*
|
||||
* @param array $configuration
|
||||
* A configuration array containing information about the plugin instance.
|
||||
* @param string $plugin_id
|
||||
* The plugin_id for the plugin instance.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\Core\Utility\Token
|
||||
* The token service.
|
||||
* @param \Drupal\Core\Utility\Token $token
|
||||
* The token replacement service.
|
||||
* @param \Drupal\Core\Render\RendererInterface $renderer
|
||||
* The renderer.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, Token $token, RendererInterface $renderer) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->token = $token;
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static($configuration, $plugin_id, $plugin_definition, $container->get('token'));
|
||||
return new static($configuration, $plugin_id, $plugin_definition, $container->get('token'), $container->get('renderer'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,8 +76,13 @@ class MessageAction extends ConfigurableActionBase implements ContainerFactoryPl
|
|||
if (empty($this->configuration['node'])) {
|
||||
$this->configuration['node'] = $entity;
|
||||
}
|
||||
$message = $this->token->replace(Xss::filterAdmin($this->configuration['message']), $this->configuration);
|
||||
drupal_set_message($message);
|
||||
$message = $this->token->replace($this->configuration['message'], $this->configuration);
|
||||
$build = [
|
||||
'#markup' => $message,
|
||||
];
|
||||
|
||||
// @todo Fix in https://www.drupal.org/node/2577827
|
||||
drupal_set_message($this->renderer->renderPlain($build));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +104,7 @@ class MessageAction extends ConfigurableActionBase implements ContainerFactoryPl
|
|||
'#default_value' => $this->configuration['message'],
|
||||
'#required' => TRUE,
|
||||
'#rows' => '8',
|
||||
'#description' => t('The message to be displayed to the current user. You may include placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
|
||||
'#description' => t('The message to be displayed to the current user. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,9 @@ class MigrateActionConfigsTest extends MigrateDrupal6TestBase {
|
|||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('action');
|
||||
public static $modules = ['action'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
Reference in a new issue