cincopa-8.x-1.x-dev/cincopa.module
cincopa.module
<?php /** * @file * Primary hook implementations for the Cincopa module. */ /** * Implements hook_element_info_alter(). */ function cincopa_element_info_alter(array &$types) { if (isset($types['toolbar'])) { $types['toolbar']['#attached']['library'][] = 'cincopa/cincopa.gallery'; } } /** * Implements hook_element_info_alter(). */ function cincopa_ckeditor_plugin_info_alter(array &$plugins) { $plugins['cincopagallery'] = [ 'id' => 'cincopagallery', 'label' => t('Insert Media from Cincopa'), 'module' => 'cincopa', 'class' => 'Drupal\cincopa\Plugin\CKEditorPlugin\Cincopagallery', 'provider' => 'cincopa', ]; $plugins['cincopaselgallery'] = [ 'id' => 'cincopaselgallery', 'label' => t('Select Cincopa Gallery'), 'module' => 'cincopa', 'class' => 'Drupal\cincopa\Plugin\CKEditorPlugin\Cincopaselgallery', 'provider' => 'cincopa', ]; } /** * Implements hook_element_info_alter(). */ function cincopa_theme($existing, $type, $theme, $path) { return [ 'cincopa' => [ 'variables' => ['url' => NULL, 'login_url' => NULL, 'data' => NULL], ], ]; } /** * Implements hook_theme_registry_alter(). */ function cincopa_theme_registry_alter(array &$theme_registry) { $theme_registry['status_messages']['function'] = 'cincopa_display_messages'; } /** * Callback for rendering the status message. * * @param array $variables * All render variables. */ function cincopa_display_messages(array &$variables) { $is_admin = \Drupal::service('router.admin_context')->isAdminRoute(); if (\Drupal::currentUser()->hasPermission('View the administration theme') && $is_admin && !isset($_COOKIE['cincopa_help_close'])) { return '<div class="cincopa_help_wrapper"><div id="icon_close" class="icon-close"></div><div class="cincopa_help"><p> <img src="https://www.cincopa.com/_cms/design15/icons/favicon-32.png?affdata=drupal-plugin-7,welcome-msg" height="15px"> Welcome to Cincopa Rich Media Plugin - the most popular way to add videos, photo galleries, slideshows, Cooliris gallery, podcast and music to your site.</p>Check our <input type="button" class="form-submit" value="Welcome page" onclick="window.open(\'https://www.cincopa.com/drupal/welcome\');"> for registration and support documents.</div></div><br/>'; } }