Commit fcbdd1b8 authored by TR's avatar TR

Clean up some code: Whitespace, quoting, comments, and text strings.

parent 190cbf26
......@@ -23,7 +23,7 @@ rules.context.values:
label: 'Context values'
mapping:
# The entries depend on the plugin here. Plugins have to extend this and
# provide a suiting schema.
# provide a suitable schema.
rules.context.processors:
type: ignore
......
......@@ -10,7 +10,7 @@ rules_expression:
rules_expression.rules_condition:
type: rules_expression
label: "Rules condition configuration"
label: 'Rules condition configuration'
mapping:
id:
type: string
......@@ -39,7 +39,7 @@ rules_expression.rules_condition:
rules_expression.rules_action:
type: rules_expression
label: "Rules action configuration"
label: 'Rules action configuration'
mapping:
id:
type: string
......@@ -100,7 +100,7 @@ rules_expression.rules_action_set:
rules_expression.rules_rule:
type: rules_expression
label: "Rule"
label: 'Rule'
mapping:
id:
type: string
......
......@@ -164,7 +164,7 @@ class ContextConfig {
* @return array
* The config array, with the following keys set:
* - context_map: An array of data selectors, keyed by context name.
* - context An array of context values, keyed by context.
* - context_values: An array of context values, keyed by context name.
* - context_processors: An array of data processor config, keyed by context
* name and process plugin id.
* - provides_mapping: An array of context names to use for provided
......
......@@ -58,7 +58,8 @@ class RulesAction extends Plugin {
/**
* An array of context definitions describing the context used by the plugin.
*
* Array keys are the names of the contexts and values are context definitions.
* Array keys are the names of the context variables and values are the
* context definitions.
*
* @var \Drupal\Core\Annotation\ContextDefinition[]
*/
......@@ -67,7 +68,8 @@ class RulesAction extends Plugin {
/**
* Defines the provided context of the action plugin.
*
* Array keys are the names of the contexts and values are context definitions.
* Array keys are the names of the context variables and values are the
* context definitions.
*
* @var \Drupal\Core\Annotation\ContextDefinition[]
*/
......
......@@ -58,6 +58,8 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
/**
* {@inheritdoc}
*
* @todo this documentation is not actually inherited from any interface.
*/
public function getConfiguration() {
return [
......@@ -67,6 +69,8 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
/**
* {@inheritdoc}
*
* @todo this documentation is not actually inherited from any interface.
*/
public function setConfiguration(array $configuration) {
$this->configuration = $configuration + $this->defaultConfiguration();
......@@ -75,6 +79,9 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
/**
* {@inheritdoc}
*
* @todo this documentation is not actually inherited from any interface.
* Do we need this empty implementation?
*/
public function defaultConfiguration() {
return [];
......@@ -82,6 +89,9 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
/**
* {@inheritdoc}
*
* @todo this documentation is not actually inherited from any interface.
* Do we need this empty implementation?
*/
public function calculateDependencies() {
return [];
......@@ -89,6 +99,9 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
/**
* {@inheritdoc}
*
* @todo this documentation is not actually inherited from any interface.
* Do we need this empty implementation?
*/
public function executeMultiple(array $objects) {
// @todo Remove this once it is removed from the interface.
......
......@@ -12,11 +12,11 @@ use Drupal\rules\Context\AnnotatedClassDiscovery;
use Drupal\rules\Core\Annotation\RulesAction;
/**
* Provides an Action plugin manager for the Rules actions API.
* Provides a RulesAction plugin manager for the Rules actions API.
*
* @see \Drupal\Core\Annotation\Action
* @see \Drupal\Core\Action\ActionInterface
* @see \Drupal\Core\Action\ActionBase
* @see \Drupal\rules\Core\Annotation\RulesAction
* @see \Drupal\rules\Core\RulesActionInterface
* @see \Drupal\rules\Core\RulesActionBase
* @see plugin_api
*/
class RulesActionManager extends DefaultPluginManager implements RulesActionManagerInterface {
......
......@@ -56,7 +56,7 @@ class ReactionRuleStorage extends ConfigEntityStorage {
* @param \Drupal\Core\State\StateInterface $state_service
* The state service.
* @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
* The drupal kernel.
* The Drupal kernel.
* @param \Drupal\rules\Core\RulesEventManager $event_manager
* The Rules event manager.
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface|null $memory_cache
......
......@@ -11,7 +11,6 @@ use Drupal\rules\Context\DataProcessorManagerTrait;
* Provides form logic for handling contexts when configuring an expression.
*/
trait ContextFormTrait {
use DataProcessorManagerTrait;
/**
......
......@@ -9,12 +9,12 @@ use Drupal\rules\Core\RulesConditionBase;
*
* @Condition(
* id = "rules_list_count_is",
* label = @Translation("List Count Comparison"),
* label = @Translation("List count comparison"),
* category = @Translation("Data"),
* context = {
* "list" = @ContextDefinition("list",
* label = @Translation("List"),
* description = @Translation("A multi value data element to have its count compared, specified by using a data selector, eg 'node.uid.entity.roles'.")
* description = @Translation("A multi-valued data element to have its count compared, specified by using a data selector, eg 'node.uid.entity.roles'.")
* ),
* "operator" = @ContextDefinition("string",
* label = @Translation("Operator"),
......
......@@ -28,7 +28,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* ),
* "message" = @ContextDefinition("string",
* label = @Translation("Message"),
* description = @Translation("The email's message body.")
* description = @Translation("The email's message body. This must be plain text, but may contain tokens.")
* ),
* "reply" = @ContextDefinition("email",
* label = @Translation("Reply to"),
......
......@@ -64,7 +64,9 @@ class TokenProcessor extends PluginBase implements DataProcessorInterface, Conta
foreach ($placeholders_by_data as $variable_name => $placeholders) {
// Note that accessing an unavailable variable will throw an evaluation
// exception. That's exactly what needs to happen. Invalid tokens must
// be checked when checking integrity.
// be detected when checking integrity. The Rule must not be executed
// if the integrity check fails. Runtime is too late to handle
// invalid tokens gracefully.
$data[$variable_name] = $rules_state->getVariable($variable_name);
}
return $this->placeholderResolver->replacePlaceHolders($value, $data);
......
......@@ -81,6 +81,7 @@ class RulesUiRouteSubscriber extends RouteSubscriberBase {
->addRequirements($requirements);
$collection->add($ui_definition->base_route . '.expression.add', $route);
// Route for editing expressions in a Rule.
$route = (new Route($base_route->getPath() . '/edit/{uuid}'))
->addDefaults([
'_form' => '\Drupal\rules\Form\EditExpressionForm',
......@@ -90,6 +91,7 @@ class RulesUiRouteSubscriber extends RouteSubscriberBase {
->addRequirements($requirements);
$collection->add($ui_definition->base_route . '.expression.edit', $route);
// Route for deleting expressions from a Rule.
$route = (new Route($base_route->getPath() . '/delete/{uuid}'))
->addDefaults([
'_form' => '\Drupal\rules\Form\DeleteExpressionForm',
......@@ -99,6 +101,7 @@ class RulesUiRouteSubscriber extends RouteSubscriberBase {
->addRequirements($requirements);
$collection->add($ui_definition->base_route . '.expression.delete', $route);
// Route to break the lock of an edited rule.
$route = (new Route($base_route->getPath() . '/break-lock'))
->addDefaults([
'_form' => '\Drupal\rules\Form\BreakLockForm',
......@@ -108,6 +111,7 @@ class RulesUiRouteSubscriber extends RouteSubscriberBase {
->addRequirements($requirements);
$collection->add($ui_definition->base_route . '.break_lock', $route);
// Route for data selector autocomplete.
$route = (new Route($base_route->getPath() . '/autocomplete/{uuid}'))
->addDefaults([
'_controller' => '\Drupal\rules\Controller\AutocompleteController::autocomplete',
......
......@@ -31,7 +31,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @see \Drupal\rules\Ui\RulesUiDefinition::settings()
*/
class RulesUiConfigHandler extends PluginBase implements RulesUiHandlerInterface, ContainerFactoryPluginInterface {
use TempStoreTrait;
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment