function collageformatter_install in Collage Formatter 8
Implements hook_install().
File
- ./
collageformatter.install, line 8
Code
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();
}
}