You are here

thunder_ivw.install in Thunder 6.2.x

Thunder IVW install hooks.

File

modules/thunder_ivw/thunder_ivw.install
View source
<?php

/**
 * @file
 * Thunder IVW install hooks.
 */

/**
 * Implements hook_install().
 */
function thunder_ivw_install() {
  $fieldWidget = 'ivw_integration_widget';

  // Attach field if channel vocabulary and article node type is
  // present in the distribution.
  try {
    \Drupal::service('entity_display.repository')
      ->getFormDisplay('node', 'article', 'default')
      ->setComponent('field_ivw', [
      'type' => $fieldWidget,
    ])
      ->save();
  } catch (Exception $e) {
    \Drupal::logger('thunder')
      ->info(t('Could not add ivw field to article node: "@message"', [
      '@message' => $e
        ->getMessage(),
    ]));
  }
  try {
    \Drupal::service('entity_display.repository')
      ->getFormDisplay('taxonomy_term', 'channel', 'default')
      ->setComponent('field_ivw', [
      'type' => $fieldWidget,
    ])
      ->save();
  } catch (Exception $e) {
    \Drupal::logger('thunder')
      ->info(t('Could not add ivw field to channel taxonomy: "@message"', [
      '@message' => $e
        ->getMessage(),
    ]));
  }
}

/* hook_update_n implementations should be in the profile instead of this
submodule. */

Functions

Namesort descending Description
thunder_ivw_install Implements hook_install().