billwerk_subscriptions-1.x-dev/modules/billwerk_subscriptions_entities/billwerk_subscriptions_entities.install

modules/billwerk_subscriptions_entities/billwerk_subscriptions_entities.install
<?php

/**
 * @file
 * The billwerk subscriptions entities install file.
 */

use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Installs a new role field.
 */
function billwerk_subscriptions_entities_update_10001() {
  $roleField = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Role'))
    ->setDescription(t('The associated user role that is assigned to the user when this add-on is actively subscribed to.'))
    ->setSettings([
      'allowed_values' => \Drupal::service('billwerk_subscriptions_handler_default.billwerk_roles_manager')->getBillwerkRolesSelectOptions(),
    ])
    ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'string',
      'weight' => -4,
    ])
    ->setDisplayOptions('form', [
      'type' => 'options_select',
      'weight' => -4,
    ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE)
    ->setRequired(TRUE);

  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('role', 'billwerk_plan_variant', 'billwerk_subscriptions_entities', $roleField);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('role', 'billwerk_component', 'billwerk_subscriptions_entities', $roleField);
}

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

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