You are here

tca.install in Token Content Access 8

Same filename and directory in other branches
  1. 2.0.x tca.install

Contains tca.install.

File

tca.install
View source
<?php

/**
 * @file
 * Contains tca.install.
 */

/**
 * Add the public field to TCA Settings entity.
 */
function tca_update_8101(&$sandbox) {
  $plugin_manager = \Drupal::service('plugin.manager.tca_plugin');
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $plugin_definitions = $plugin_manager
    ->getDefinitions();
  foreach ($plugin_definitions as $plugin_definition) {
    $provider = $plugin_definition['provider'];
    $entity_type_id = $plugin_definition['entityType'];
    $plugin = $plugin_manager
      ->createInstanceByEntityType($entity_type_id);
    if ($plugin && $plugin
      ->isFieldable()) {
      $fields = _tca_extra_field_definitions();
      foreach ($fields as $name => $storage_definition) {
        if (in_array($name, [
          'tca_public',
        ])) {
          $definition_update_manager
            ->installFieldStorageDefinition($name, $entity_type_id, $provider, $storage_definition);
        }
      }
    }
  }
}

Functions

Namesort descending Description
tca_update_8101 Add the public field to TCA Settings entity.