elevatezoomplus.install in ElevateZoom Plus 7
Same filename and directory in other branches
Installation actions for ElevateZoomPlus.
File
elevatezoomplus.installView source
<?php
/**
* @file
* Installation actions for ElevateZoomPlus.
*/
use Drupal\elevatezoomplus\Entity\ElevateZoomPlus;
/**
* Implements hook_requirements().
*/
function elevatezoomplus_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$requirements = [];
// Ensure translations do not break at install time.
$t = get_t();
// ElevateZoomPlus library.
$path = libraries_get_path('elevatezoom-plus') ?: libraries_get_path('ez-plus');
$exists = $path ? is_file($path . '/src/jquery.ez-plus.js') : FALSE;
$requirements['elevatezoomplus_library'] = [
'title' => $t('ElevateZoom Plus library'),
'description' => $exists ? '' : $t('The <a href=":url">ElevateZoom Plus library</a> should be installed at <strong>/sites/../libraries/elevatezoom-plus/src/jquery.ez-plus.js</strong>, or any path supported by libraries.module if installed.', [
':url' => 'https://github.com/igorlino/elevatezoom-plus',
]),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? $t('Installed') : $t('Not installed'),
];
return $requirements;
}
/**
* Returns schema for elevatezoomplus.
*/
function _elevatezoomplus_schema() {
return [
'description' => 'Store optionsets for elevatezoomplus instances.',
'export' => [
'object' => 'Drupal\\elevatezoomplus\\Entity\\ElevateZoomPlus',
'key' => 'name',
'key name' => 'Optionset',
'primary key' => 'name',
'identifier' => 'optionset',
'admin_title' => 'label',
'default hook' => 'elevatezoomplus_optionsets',
'bulk export' => TRUE,
'api' => [
'owner' => 'elevatezoomplus',
'api' => 'elevatezoomplus_optionset',
'minimum_version' => 1,
'current_version' => 1,
],
],
'fields' => [
'name' => [
'description' => 'The machine-readable option set name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'label' => [
'description' => 'The human-readable label for this option set.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'options' => [
'description' => 'The options array.',
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
],
],
'primary key' => [
'name',
],
];
}
/**
* Implements hook_schema().
*/
function elevatezoomplus_schema() {
$schema = [];
$schema[ElevateZoomPlus::TABLE] = _elevatezoomplus_schema();
return $schema;
}
Functions
Name | Description |
---|---|
elevatezoomplus_requirements | Implements hook_requirements(). |
elevatezoomplus_schema | Implements hook_schema(). |
_elevatezoomplus_schema | Returns schema for elevatezoomplus. |