popup_filter.install in Popup 8
File
modules/popup_filter/popup_filter.install
View source
<?php
function popup_filter_install() {
$format_exists = (bool) \Drupal::database()
->queryRange('SELECT 1 FROM {filter_format} WHERE name = :name', 0, 1, array(
':name' => 'Popup tags',
))
->fetchField();
if (!$format_exists) {
$popup_format = array(
'format' => 'popup_tags',
'name' => 'Popup tags',
'module' => 'popup_filter',
'filters' => array(
'popup_tags' => array(
'weight' => 0,
'status' => 1,
),
),
);
}
$popup_format = (object) $popup_format;
filter_format_save($popup_format);
\Drupal::messenger()
->addMessage(t('A <a href="@popup">Popup tags</a> text format has been created.', array(
'@popup' => url('admin/config/content/formats/' . $popup_format->format),
)));
}
function popup_filter_uninstall() {
\Drupal::database()
->query("DELETE FROM {filter_format} WHERE name='Popup tags'");
\Drupal::database()
->query("DELETE FROM {filter} WHERE module='popup_filter'");
}