/** * Executes the selected operation on the provided data. * * @param $data * The data to to operate on. An entity or an array of entities. * @param $context * An array of related data (selected views rows, etc). */ public function execute($data, array $context) { // If there was a config form, there's a rules_element. // If not, fallback to the component key. if ($this->configurable()) { $element = $this->rulesElement; } else { $element = rules_action('component_' . $this->operationInfo['parameters']['component_key']); } $element->execute($data); }
/** * Executes the selected operation on the provided data. * * @param $data * The data to to operate on. An entity or an array of entities. * @param $context * An array of related data (selected views rows, etc). */ public function execute($data, array $context) { // If there was a config form, there's a rules_element. // If not, fallback to the component key. if ($this->configurable()) { $element = $this->rulesElement; } else { $element = rules_action('component_' . $this->operationInfo['parameters']['component_key']); } $wrapper_type = is_array($data) ? "list<{$this->entityType}>" : $this->entityType; $wrapper = entity_metadata_wrapper($wrapper_type, $data); $element->execute($wrapper); }