Last active
August 29, 2015 14:17
-
-
Save fago/b1caea6731f147556955 to your computer and use it in GitHub Desktop.
Rules static helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $rule = \Drupal\rules\Rules::expressionManager() | |
| ->createRule([ | |
| 'context_definitions' => [ | |
| 'user' => [ | |
| 'type' => 'entity:user', | |
| 'label' => 'User', | |
| 'description' => 'The user whose mail address to print.', | |
| ], | |
| ], | |
| ]); | |
| $rule->addAction('rules_system_message', \Drupal\rules\Context\ContextConfig::create() | |
| ->map('message', 'user:mail:value')); | |
| $config_entity = \Drupal\rules\Entity\RulesComponent::create([ | |
| 'id' => 'rules_test_default_component' | |
| ])->setExpression($rule); | |
| $config_entity->save(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment