You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
4 years ago
|
<?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'] = file_default_scheme();
|
||
|
return $config;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
|
||
|
$form = parent::buildConfigurationForm($form, $form_state);
|
||
|
$form['mimetype']['#description'] = t('Mimetype to convert to (e.g. application/xml, etc...)');
|
||
|
$form['mimetype']['#value'] = 'image/jpeg';
|
||
|
$form['mimetype']['#type'] = 'hidden';
|
||
|
return $form;
|
||
|
}
|
||
|
|
||
|
}
|