|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Drupal\islandora_image\Plugin\Action;
|
|
|
|
|
|
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
|
|
use Drupal\islandora\Plugin\Action\AbstractGenerateDerivativeMediaFile;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Emits a Node for generating derivatives event.
|
|
|
|
*
|
|
|
|
* @Action(
|
|
|
|
* id = "generate_image_derivative_file",
|
|
|
|
* label = @Translation("Generate an Image Derivative for Media Attachment"),
|
|
|
|
* type = "media"
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
class GenerateImageDerivativeFile extends AbstractGenerateDerivativeMediaFile {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function defaultConfiguration() {
|
|
|
|
$config = parent::defaultConfiguration();
|
|
|
|
$config['path'] = '[date:custom:Y]-[date:custom:m]/[media:mid]-ImageService.jpg';
|
|
|
|
$config['mimetype'] = 'application/xml';
|
|
|
|
$config['queue'] = 'islandora-connector-houdini';
|
|
|
|
$config['destination_media_type'] = 'file';
|
|
|
|
$config['scheme'] = $this->config('system.file')->get('default_scheme');
|
|
|
|
return $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
|
|
|
|
$form = parent::buildConfigurationForm($form, $form_state);
|
|
|
|
$form['mimetype']['#description'] = $this->t('Mimetype to convert to (e.g. application/xml, etc...)');
|
|
|
|
$form['mimetype']['#value'] = 'image/jpeg';
|
|
|
|
$form['mimetype']['#type'] = 'hidden';
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|