collageformatter.install in Collage Formatter 8
File
collageformatter.installView source
<?php
use Drupal\image\Entity\ImageStyle;
/**
* Implements hook_install().
*/
function collageformatter_install() {
if (!ImageStyle::load('collageformatter')) {
$style = ImageStyle::create([
'name' => 'collageformatter',
'label' => 'Collage Formatter',
'weight' => 0,
]);
// Create effect
$configuration = [
'uuid' => NULL,
'id' => 'collageformatter',
'weight' => 0,
];
$effect = \Drupal::service('plugin.manager.image.effect')
->createInstance($configuration['id'], $configuration);
// Add it to the image style and save.
$style
->addImageEffect($effect
->getConfiguration());
$style
->save();
}
}
Functions
Name | Description |
---|---|
collageformatter_install | Implements hook_install(). |