|
|
|
@ -2,6 +2,8 @@
|
|
|
|
|
|
|
|
|
|
namespace Drupal\islandora\Plugin\ContextReaction; |
|
|
|
|
|
|
|
|
|
use Drupal\Core\Form\FormStateInterface; |
|
|
|
|
use Drupal\islandora\Plugin\Action\AbstractGenerateDerivative; |
|
|
|
|
use Drupal\islandora\PresetReaction\PresetReaction; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -12,4 +14,30 @@ use Drupal\islandora\PresetReaction\PresetReaction;
|
|
|
|
|
* label = @Translation("Derivative") |
|
|
|
|
* ) |
|
|
|
|
*/ |
|
|
|
|
class DerivativeReaction extends PresetReaction {} |
|
|
|
|
class DerivativeReaction extends PresetReaction { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* {@inheritdoc} |
|
|
|
|
*/ |
|
|
|
|
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { |
|
|
|
|
$actions = $this->actionStorage->loadMultiple(); |
|
|
|
|
foreach ($actions as $action) { |
|
|
|
|
$plugin = $action->getPlugin(); |
|
|
|
|
if ($plugin instanceof AbstractGenerateDerivative) { |
|
|
|
|
$options[ucfirst($action->getType())][$action->id()] = $action->label(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$config = $this->getConfiguration(); |
|
|
|
|
$form['actions'] = [ |
|
|
|
|
'#title' => $this->t('Actions'), |
|
|
|
|
'#description' => $this->t('Pre-configured actions to execute. Multiple actions may be selected by shift or ctrl clicking.'), |
|
|
|
|
'#type' => 'select', |
|
|
|
|
'#multiple' => TRUE, |
|
|
|
|
'#options' => $options, |
|
|
|
|
'#default_value' => isset($config['actions']) ? $config['actions'] : '', |
|
|
|
|
'#size' => 15, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|