You are here

opigno_notification.install in Opigno notifications 8

Same filename and directory in other branches
  1. 3.x opigno_notification.install

Opigno notification app install/update functionality.

File

opigno_notification.install
View source
<?php

/**
 * @file
 * Opigno notification app install/update functionality.
 */
use Drupal\Core\Config\FileStorage;
use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Add "properties" field to "opigno_notification" entity.
 */
function opigno_notification_update_8001() {
  $definition = BaseFieldDefinition::create('string')
    ->setLabel(t('Url'))
    ->setDescription(t('The url string for notification entity.'))
    ->setSettings([
    'max_length' => 50,
  ])
    ->setInitialValue('/notifications')
    ->setDefaultValue('/notifications');
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('url', 'opigno_notification', 'opigno_notification', $definition);
}

/**
 * Update views: 'Opigno notifications'.
 */
function opigno_notification_update_8002() {
  $config_path = drupal_get_path('module', 'opigno_notification') . '/config/optional';
  $storage = new FileStorage($config_path);
  $config_storage = \Drupal::service('config.storage');
  $data = $storage
    ->read('views.view.opigno_notifications');
  $config_storage
    ->write('views.view.opigno_notifications', $data);
}

/**
 * Update views: 'Opigno notifications'.
 */
function opigno_notification_update_8003() {
  $config_path = drupal_get_path('module', 'opigno_notification') . '/config/optional';
  $storage = new FileStorage($config_path);
  $config_storage = \Drupal::service('config.storage');
  $data = $storage
    ->read('views.view.opigno_notifications');
  $config_storage
    ->write('views.view.opigno_notifications', $data);
}

/**
 * Update views: 'Opigno notifications'.
 */
function opigno_notification_update_8004() {
  $config_path = drupal_get_path('module', 'opigno_notification') . '/config/optional';
  $storage = new FileStorage($config_path);
  $config_storage = \Drupal::service('config.storage');
  $data = $storage
    ->read('views.view.opigno_notifications');
  $config_storage
    ->write('views.view.opigno_notifications', $data);
}

Functions

Namesort descending Description
opigno_notification_update_8001 Add "properties" field to "opigno_notification" entity.
opigno_notification_update_8002 Update views: 'Opigno notifications'.
opigno_notification_update_8003 Update views: 'Opigno notifications'.
opigno_notification_update_8004 Update views: 'Opigno notifications'.