function thunder_ivw_install in Thunder 8.5
Same name and namespace in other branches
- 6.2.x modules/thunder_ivw/thunder_ivw.install \thunder_ivw_install()
- 6.0.x modules/thunder_ivw/thunder_ivw.install \thunder_ivw_install()
- 6.1.x modules/thunder_ivw/thunder_ivw.install \thunder_ivw_install()
Implements hook_install().
File
- modules/
thunder_ivw/ thunder_ivw.install, line 11 - Thunder IVW install hooks.
Code
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(),
]));
}
}