Browse Source

Merge 7f0b8a9fd4 into 222c9601c1

pull/751/merge
Alan Stanley 3 years ago committed by GitHub
parent
commit
02832b610d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      src/Plugin/ContextReaction/DerivativeReaction.php

32
src/Plugin/ContextReaction/DerivativeReaction.php

@ -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,32 @@ 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();
$options = [];
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;
}
}

Loading…
Cancel
Save