md_slider-1.5.4/md_slider.install

md_slider.install
<?php
use Drupal\image\Entity\ImageStyle;
use Drupal\Core\File;
/**
 * Implements hook_schema().
 */
function md_slider_schema() {
  $schema['md_sliders'] = array(
    'description' => 'Slideshows table',
    'fields' =>  array(
      'slid' => array(
        'description' =>  'Primary key for identify a slideshow.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The name of slideshow.',
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'description' => array(
        'description' => 'The description about slideshow is created.',
        'type' => 'varchar',
        'length' => 1000,
      ),
      'machine_name' => array(
        'description' => 'The machine name of slideshow. The uniquied values.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'settings' => array(
        'description' => 'A serialized array settings for slideshow.',
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array('slid'),
  );

  $schema['md_slides'] = array(
    'description' => 'Slides table',
    'fields' => array(
      'sid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary key for identify a slide.',
      ),
      'name' => array(
        'type' => 'text',
        'description' => 'The name of slider.',
        'size' => 'big',
        'not null' => TRUE,
      ),
      'slid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => "Slideshow id contain this slide.",
      ),
      'position' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Order of slide in slideshow.',
      ),
      'settings' => array(
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'description' => "Settings for tab",
      ),
      'layers' => array(
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'description' => "Items in this slide",
      ),
    ),
    'foreign keys' => array(
      'md_sliders' => array(
        'table' => 'md_sliders',
        'columns' => array('slid' => 'slid'),
      ),
    ),
    'primary key' => array('sid'),
  );

  return $schema;
}

function md_slider_uninstall() {
  // Remove the css directory
  //file_unmanaged_delete_recursive(file_default_scheme() . '://md-slider-css');
  \Drupal::service('file_system')->deleteRecursive(Drupal::config('system.file')->get('default_scheme')  . '://md-slider-css');
  
  // Remove image style md_slider_thumb
  ImageStyle::load('md_slider_thumb')->delete();
}

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

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