diff --git a/config/schema/rules.context.schema.yml b/config/schema/rules.context.schema.yml index 9e2169e1963d8ca4b10faf1aa042509f23dd734e..74ae08e92514d03519fd5f9b695cc0e8ccb32ae0 100644 --- a/config/schema/rules.context.schema.yml +++ b/config/schema/rules.context.schema.yml @@ -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 diff --git a/config/schema/rules.expression.schema.yml b/config/schema/rules.expression.schema.yml index ab6d406889a9473f4016f83ee67967fd9e99b47a..bf1bf4f09734060c63cb57fad60822f3f42deb8c 100644 --- a/config/schema/rules.expression.schema.yml +++ b/config/schema/rules.expression.schema.yml @@ -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 diff --git a/src/Context/ContextConfig.php b/src/Context/ContextConfig.php index 0d1af488683cee4f8dfed62c71d8c569d5875f8c..d0731aab798b9dfaf671c8bdff83010f1bd8e0f7 100644 --- a/src/Context/ContextConfig.php +++ b/src/Context/ContextConfig.php @@ -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 diff --git a/src/Core/Annotation/RulesAction.php b/src/Core/Annotation/RulesAction.php index 120bc946cb1d35a6d830f8c55430ef437b9768d5..40d00956b04ee89891a89bd565f6a0ae225ebed7 100644 --- a/src/Core/Annotation/RulesAction.php +++ b/src/Core/Annotation/RulesAction.php @@ -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[] */ diff --git a/src/Core/RulesActionBase.php b/src/Core/RulesActionBase.php index 021149a10d566af2817f54d5008e4693e8d31989..28267b7281de227fa9ffd7ad1994a415ceff72b9 100644 --- a/src/Core/RulesActionBase.php +++ b/src/Core/RulesActionBase.php @@ -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. diff --git a/src/Core/RulesActionManager.php b/src/Core/RulesActionManager.php index 5f92ad7531619a8765f7a0ed47f4e69caa881ca6..f9518497df47b73d04c04ee25d98808971620c7f 100644 --- a/src/Core/RulesActionManager.php +++ b/src/Core/RulesActionManager.php @@ -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 { diff --git a/src/Entity/ReactionRuleStorage.php b/src/Entity/ReactionRuleStorage.php index b2dfd7507506aa193e7beacdad2eb9e8dac59736..ca89fbca3c602bead15144910ebc94cb8c28bb6b 100644 --- a/src/Entity/ReactionRuleStorage.php +++ b/src/Entity/ReactionRuleStorage.php @@ -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 diff --git a/src/Form/Expression/ContextFormTrait.php b/src/Form/Expression/ContextFormTrait.php index fbf0adf754b848a67b0418356a97db86a9c909f4..61721a62099de54255ef1e7def9115f1becc7e91 100644 --- a/src/Form/Expression/ContextFormTrait.php +++ b/src/Form/Expression/ContextFormTrait.php @@ -11,7 +11,6 @@ use Drupal\rules\Context\DataProcessorManagerTrait; * Provides form logic for handling contexts when configuring an expression. */ trait ContextFormTrait { - use DataProcessorManagerTrait; /** diff --git a/src/Plugin/Condition/DataListCountIs.php b/src/Plugin/Condition/DataListCountIs.php index c611478cf046ca549593f137ddc49a59aded5450..c64a8eef9a9ab8126db450f1f05477e014000074 100644 --- a/src/Plugin/Condition/DataListCountIs.php +++ b/src/Plugin/Condition/DataListCountIs.php @@ -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"), diff --git a/src/Plugin/RulesAction/SystemSendEmail.php b/src/Plugin/RulesAction/SystemSendEmail.php index 821bffc457905b09b9ae255d060e4f0cc3d4dcbd..1f3acb8613aea6de137d5a6a2454d0737ebbcf36 100644 --- a/src/Plugin/RulesAction/SystemSendEmail.php +++ b/src/Plugin/RulesAction/SystemSendEmail.php @@ -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"), diff --git a/src/Plugin/RulesDataProcessor/TokenProcessor.php b/src/Plugin/RulesDataProcessor/TokenProcessor.php index 163f2c49a21ba9e629d29b51005b2e1a67f97c49..c9e2fd660671ecc2b2d1d22626c7f97bb7fb5435 100644 --- a/src/Plugin/RulesDataProcessor/TokenProcessor.php +++ b/src/Plugin/RulesDataProcessor/TokenProcessor.php @@ -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); diff --git a/src/Routing/RulesUiRouteSubscriber.php b/src/Routing/RulesUiRouteSubscriber.php index 9cdf0e83898082d5aa93098f686b56486ac2ad39..c444c7c8f7a23de58f2ef5de951ad7dbb06d2c23 100644 --- a/src/Routing/RulesUiRouteSubscriber.php +++ b/src/Routing/RulesUiRouteSubscriber.php @@ -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', diff --git a/src/Ui/RulesUiConfigHandler.php b/src/Ui/RulesUiConfigHandler.php index 47c0a67b9f82c82a64c06133c57e78ab3b7cae8f..dd40adb00ba5a3117e2ee9ccb8e29ac3bc0a380a 100644 --- a/src/Ui/RulesUiConfigHandler.php +++ b/src/Ui/RulesUiConfigHandler.php @@ -31,7 +31,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * @see \Drupal\rules\Ui\RulesUiDefinition::settings() */ class RulesUiConfigHandler extends PluginBase implements RulesUiHandlerInterface, ContainerFactoryPluginInterface { - use TempStoreTrait; /**