You are here

simple_styleguide.install in Simple Style Guide 8

File

simple_styleguide.install
View source
<?php

/**
 * @file
 * Contains simple_styleguide.install.
 */
use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Adding weight field to styleguide patterns.
 */
function simple_styleguide_update_8001() {
  $field_storage_definition = BaseFieldDefinition::create('integer')
    ->setLabel(t('Weight'))
    ->setDescription(t('Row weight of entity.'))
    ->setDefaultValue(0)
    ->setRevisionable(FALSE);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('start', 'styleguide_pattern', 'styleguide_pattern', $field_storage_definition);
}

/**
 * Adding description field to styleguide patterns.
 */
function simple_styleguide_update_8002() {
  $field_storage_definition = BaseFieldDefinition::create('text_long')
    ->setLabel(t('Description'))
    ->setDescription(t('Description of entity.'))
    ->setDefaultValue(0)
    ->setRevisionable(FALSE);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('description', 'styleguide_pattern', 'styleguide_pattern', $field_storage_definition);
}

Functions

Namesort descending Description
simple_styleguide_update_8001 Adding weight field to styleguide patterns.
simple_styleguide_update_8002 Adding description field to styleguide patterns.