You are here

fiu_ui.module in Fine Image Upload 8.2

General functions and hook implementations.

File

fiu_ui/fiu_ui.module
View source
<?php

/**
 * @file
 * General functions and hook implementations.
 */
use Drupal\Core\Asset\AttachedAssetsInterface;

/**
 * Implements hook_theme().
 */
function fiu_ui_theme() {
  return [
    'fiu_ui_preview' => [
      'variables' => [
        'data' => [],
      ],
    ],
  ];
}

/**
 * Implements hook_css_alter().
 */
function fiu_ui_css_alter(&$css, AttachedAssetsInterface $assets) {
  $status = \Drupal::config('fiu_ui.settings')
    ->get('status');
  if (isset($css['modules/contrib/fiu/css/theme.css']) && $status) {
    unset($css['modules/contrib/fiu/css/theme.css']);
  }
}

/**
 * Implements template_preprocess_fine_image_widget().
 */
function fiu_ui_preprocess_fine_image_widget(&$variables) {
  $status = \Drupal::config('fiu_ui.settings')
    ->get('status');
  if ($status) {
    $variables['#attached']['library'][] = 'fiu_ui/settings';
  }
}