ckeditor_mentions-8.x-2.x-dev/ckeditor_mentions.install
ckeditor_mentions.install
<?php
/**
* @file
* Contains installation and update scripts.
*/
use Drupal\image\Entity\ImageStyle;
/**
* Implements hook_install().
*/
function ckeditor_mentions_install() {
// Create tiny icon image style.
$style = ImageStyle::create(
[
'name' => 'mentions_icon',
'label' => 'CKEditor Mentions Icon',
]
);
// Create effect.
$configuration = [
'uuid' => NULL,
'id' => 'image_scale_and_crop',
'weight' => 0,
'data' => [
'width' => 40,
'height' => 40,
],
];
$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();
}
/**
* Implements hook_uninstall().
*/
function ckeditor_mentions_uninstall() {
// Remove tiny icon image style.
\Drupal::configFactory()->getEditable('image.style.mentions_icon')->delete();
}
/**
* New version should not contain upgrade hooks.
*
* You can upgrade without any issues if you have skipped upgrade hooks.
*/
function ckeditor_mentions_update_last_removed() {
return 8003;
}
/**
* Rebuild the kernel.
*/
function ckeditor_mentions_update_10001() {
// Rebuild the Drupal kernel.
\Drupal::service('kernel')->rebuildContainer();
}
