wysiwyg_template.install in Wysiwyg API template plugin 3.0.x
Same filename and directory in other branches
File
wysiwyg_template.installView source
<?php
use Drupal\wysiwyg_template\Entity\Template;
/**
* Drop redundant database tables.
*/
function wysiwyg_template_update_8001() {
$database = Drupal::database();
foreach ([
'wysiwyg_templates',
'wysiwyg_templates_default',
'wysiwyg_templates_content_types',
] as $table) {
if ($database
->schema()
->tableExists($table)) {
$database
->schema()
->dropTable($table);
}
}
}
/**
* Migrate node types into entity types.
*/
function wysiwyg_template_update_8002() {
/** @var \Drupal\wysiwyg_template_core\TemplateInterface $template */
foreach (Template::loadMultiple() as $template) {
if (empty($template
->getBundles())) {
$template
->setBundles('node', $template
->getNodeTypes())
->save();
}
}
}
Functions
Name | Description |
---|---|
wysiwyg_template_update_8001 | Drop redundant database tables. |
wysiwyg_template_update_8002 | Migrate node types into entity types. |