Repository URL to install this package:
|
Version:
1.0.20 ▾
|
novicell/atoms
/
atoms.install
|
|---|
<?php
use Drupal\Component\Transliteration\TransliterationInterface;
use Drupal\Core\Language\LanguageInterface;
/**
* Implements hook_schema().
*/
function atoms_schema() {
$schema['atoms'] = [
'description' => 'Atomic editable data storage.',
'fields' => [
'machine_name' => [
'description' => 'Machine name for data.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'type' => [
'description' => 'The form type to use for editing',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
],
'title' => [
'description' => 'Title for the form element',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'description' => [
'description' => 'Description for the form element',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'category' => [
'description' => 'Category for the administration interface',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'group_id' => [
'description' => 'Group ID for the administration interface',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'group_name' => [
'description' => 'Group for the administration interface',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'subgroup_name' => [
'description' => 'Subgroup for the administration interface',
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
'default' => '',
],
'weight' => [
'description' => 'Weight for the administration interface',
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
],
'options' => [
'description' => 'The options required on the content',
'type' => 'blob',
'not null' => FALSE,
],
],
'primary key' => ['machine_name'],
];
$schema['atoms_data'] = [
'description' => 'Atomic content data storage.',
'fields' => [
'machine_name' => [
'description' => 'Machine name for data.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'langcode' => [
'description' => 'The language of this data',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => 'en',
],
'data' => [
'description' => 'Editable data.',
'type' => 'blob',
'not null' => FALSE,
],
],
'primary key' => ['machine_name', 'langcode'],
];
$schema['atoms_statistic'] = [
'description' => 'Atomic content statistics storage.',
'fields' => [
'machine_name' => [
'description' => 'Machine name id for text.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'langcode' => [
'description' => 'The language of this data',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => 'en',
],
'location_url' => [
'description' => 'URL of the page where the text is located',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
],
'location_selector' => [
'description' => 'The CSS selector of the element where the text is located',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
],
],
'primary key' => ['machine_name', 'langcode'],
];
return $schema;
}
/**
* Implements hook_install().
*/
function atoms_install() {
/** @var \Drupal\atoms\AtomsBuilder $builder */
$builder = \Drupal::service('atoms.builder');
$builder->rebuild();
}