ept_slick_slider-1.4.1/ept_slick_slider.install

ept_slick_slider.install
<?php

/**
 * @file
 * Install, update and uninstall functions for the EPT Slick Slider module.
 */

use Drupal\media\Entity\MediaType;

/**
 * Implements hook_requirements().
 */
function ept_slick_slider_requirements($phase) {
  if ($phase != 'install') {
    return [];
  }

  // Check if the Media module is enabled.
  $module_handler = \Drupal::service('module_handler');
  if (!$module_handler->moduleExists('media')) {
    return [];
  }

  if (class_exists('Drupal\media\Entity\MediaType')) {
    foreach (MediaType::loadMultiple() as $type) {
      if ($type->id() == 'image') {
        return [];
      }
    }
  }

  return [
    'ept_slick_slider_media_type_image' => [
      'title' => t('Media type Image'),
      'value' => t('Not created'),
      'description' => t('The EPT Slick Slider needs to be <a href="@url">created</a> "Image" Media type.', ['@url' => '/admin/structure/media']),
      'severity' => REQUIREMENT_ERROR,
    ],
  ];
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc