dropzonejs_eb_widget.install in DropzoneJS 8
Same filename and directory in other branches
Install function hooks for the DropzoneJS entity browser widget module.
File
modules/eb_widget/dropzonejs_eb_widget.installView source
<?php
/**
* @file
* Install function hooks for the DropzoneJS entity browser widget module.
*/
use Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\DropzoneJsEbWidget;
use Drupal\entity_browser\Entity\EntityBrowser;
/**
* Update configurations for new keys.
*/
function dropzonejs_eb_widget_update_8101() {
/** @var \Drupal\entity_browser\Entity\EntityBrowser[] $entity_browsers */
$entity_browsers = EntityBrowser::loadMultiple();
foreach ($entity_browsers as $entity_browser) {
/** @var \Drupal\entity_browser\WidgetInterface[] $widgets */
$widgets = $entity_browser
->getWidgets();
$has_config_changes = FALSE;
foreach ($widgets as $widget) {
if ($widget instanceof DropzoneJsEbWidget) {
$config = $widget
->getConfiguration();
$config['settings']['clientside_resize'] = FALSE;
$config['settings']['resize_height'] = 0;
$config['settings']['resize_method'] = 'contain';
$config['settings']['resize_quality'] = 1.0;
$config['settings']['resize_width'] = 0;
$config['settings']['thumbnail_method'] = 'contain';
$widget
->setConfiguration($config);
$has_config_changes = TRUE;
}
}
if ($has_config_changes) {
$entity_browser
->save();
}
}
}
Functions
Name | Description |
---|---|
dropzonejs_eb_widget_update_8101 | Update configurations for new keys. |