function DataSet::autoSaveContext
Overrides RulesActionBase::autoSaveContext
File
- 
              src/
Plugin/ RulesAction/ DataSet.php, line 50  
Class
- DataSet
 - Provides a 'Data set' action.
 
Namespace
Drupal\rules\Plugin\RulesActionCode
public function autoSaveContext() {
  // Saving is done at the root of the typed data tree, for example on the
  // entity level.
  $typed_data = $this->getContext('data')
    ->getContextData();
  $root = $typed_data->getRoot();
  $value = $root->getValue();
  // Only save things that are objects and have a save() method.
  if (is_object($value) && method_exists($value, 'save')) {
    return [
      'data',
    ];
  }
  return [];
}