Created
November 29, 2012 13:43
-
-
Save damiankloip/4169178 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* @todo. | |
*/ | |
abstract class ActionPluginBase extends PluginBase implements ActionInterface { | |
/** | |
* Implements ActionInterface::getParameter(). | |
*/ | |
public function getParameter($key) { | |
$definition = $this->getDefinition(); | |
return isset($definition['parameters'][$key]) ? $definition['parameters'][$key] : NULL; | |
} | |
/** | |
* Implements ActionInterface::getParameters(). | |
*/ | |
public function getParameters() { | |
$definition = $this->getDefinition(); | |
return $definition['parameters']; | |
} | |
/** | |
* Implements ActionInterface::setParameterValue(). | |
*/ | |
public function setParameterValue($key, $value) { | |
$definition = $this->getDefinition(); | |
if (!isset($definition['parameters'][$key])) { | |
throw new ActionException("The $key parameter is not valid for this action."); | |
} | |
$this->configuration['parameters'][$key] = $value; | |
return $this; | |
} | |
/** | |
* Implements ActionInterface::getParameterValue(). | |
*/ | |
public function getParameterValue($key) { | |
$definition = $this->getDefinition(); | |
if (!isset($definition['parameters'][$key])) { | |
throw new ActionException("The $key parameter is not valid for this action."); | |
} | |
return $this->configuration['parameters'][$key]; | |
} | |
/** | |
* Implements ActionInterface::getParameterValues(). | |
*/ | |
public function getParameterValues() { | |
return $this->configuration['parameters']; | |
} | |
/** | |
* Implements ActionInterface::setProcessor(). | |
*/ | |
public function setProcessor($plugin_id, array $configuration) { | |
$this->configuration['processors'][] = system_plugin_manager('processor')->createInstance($plugin_id, $configuration); | |
return $this; | |
} | |
/** | |
* Implements ActionInterface::getProcessor(). | |
*/ | |
public function getProcessors() { | |
return $this->configuration['processors']; | |
} | |
/** | |
* Abstract definition of ActionInterface::execute(). | |
*/ | |
abstract function execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment