This file contains 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.', | |
], | |
], |
This file contains 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
$action = $this->expressionManager->createAction('rules_test_log'); | |
<?php | |
$config_entity = $this->storage->create([ | |
'id' => 'test_rule', | |
'expression_id' => 'rules_action', | |
'configuration' => $action->getConfiguration(), | |
]); | |
$config_entity->save(); |
This file contains 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 = $this->expressionManager->createRule(); | |
// The condition provides a "provided_text" variable. | |
$rule->addCondition('rules_test_provider'); | |
// The action provides a "concatenated" variable. | |
$rule->addAction('rules_test_string', [ | |
'context_mapping' => ['text:select' => 'provided_text'], | |
]); |
This file contains 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 = $this->expressionManager->createRule([ | |
'context_definitions' => [ | |
'test' => [ | |
'type' => 'string', | |
'label' => 'Test string', | |
], | |
], | |
]); |
This file contains 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 | |
// Existing PR: https://github.com/fago/rules/pull/134/files | |
$rule->addCondition('rules_test_string_condition', [ | |
'context_mapping' => ['text:select' => 'node:uid:0:entity:name:0:value'], | |
])); | |
]); | |
// With value object: | |
$rule->addCondition('rules_test_string_condition', ContextConfig() | |
->map('text', 'node:uid:0:entity:name:0:value') |
This file contains 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 Strict standards: Drupal\Core\Plugin\DefaultPluginManager and Drupal\Core\Plugin\CategorizingPluginManagerTrait define the same property ($moduleHandler) in the composition of Drupal\Tests\Core\Plugin\CategorizingPluginManager. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /home/fago2/projects/d8/drupal/core/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php on line 139 |
This file contains 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
#!/bin/bash | |
# (c) Wolfgang Ziegler // fago | |
# | |
# Inotify script to trigger a command on file changes. | |
# | |
# The script triggers the command as soon as a file event occurs. Events | |
# occurring during command execution are aggregated and trigger a single command | |
# execution only. | |
# | |
# Usage example: Trigger rsync for synchronizing file changes. |
This file contains 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 | |
class DatabaseStorageController implements EntityStorageControllerInterface, ExtensibleStorageInterface { | |
// Helper class implements the ExtensibleStorageInterface + more needed methods like write(). | |
protected $class = 'ExtensibleDBStorageHelper'; | |
protected function getExtensibleStorageHelper() { | |
... | |
} |
This file contains 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
class DatabaseStorageController implements EntityStorageControllerInterface, ExtensibleStorageInterface { | |
protected $class = 'ExtensibleDBStorageHelper'; | |
protected function getExtensibleStorageHelper() { | |
... | |
} | |
function save() { |
This file contains 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
/** | |
* Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::setContextValue(). | |
*/ | |
public function setContextValue($key, $value) { | |
$context_definition = $this->getContextDefinition($key); | |
$this->context[$key] = new Context($context_definition); | |
$this->context[$key]->setValue($value); | |
if ($this->context[$key]->validate($value)->count() > 0) { | |
throw new PluginException("The provided value for $key is not valid."); |