You are here

function gathercontent_install in GatherContent 8.5

Same name and namespace in other branches
  1. 8 gathercontent.install \gathercontent_install()
  2. 8.3 gathercontent.install \gathercontent_install()
  3. 8.4 gathercontent.install \gathercontent_install()
  4. 7.3 gathercontent.install \gathercontent_install()

Implements hook_install().

File

./gathercontent.install, line 17
Install and uninstall script for GatherContent module.

Code

function gathercontent_install() {
  if (\Drupal::entityTypeManager()
    ->hasDefinition('taxonomy_term')) {
    $entityFieldManager = \Drupal::service('entity_field.manager');
    $definitions = $entityFieldManager
      ->getFieldStorageDefinitions('taxonomy_term');
    if (!isset($definitions['gathercontent_option_ids'])) {
      FieldStorageConfig::create([
        'field_name' => 'gathercontent_option_ids',
        'entity_type' => 'taxonomy_term',
        'type' => 'string',
        'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
        'locked' => TRUE,
        'persist_with_no_fields' => TRUE,
        'settings' => [
          'is_ascii' => FALSE,
          'case_sensitive' => FALSE,
        ],
      ])
        ->save();
    }
  }
}