function lightning_test_install in Lightning Core 8
Same name and namespace in other branches
- 8.2 modules/lightning_test/lightning_test.install \lightning_test_install()
Implements hook_install().
File
- modules/
lightning_test/ lightning_test.install, line 15 - Contains installation routines for Lightning Test.
Code
function lightning_test_install() {
entity_get_form_display('node', 'page', 'default')
->setComponent('field_multi_image', [
'type' => 'entity_browser_file',
'settings' => [
'entity_browser' => 'image_browser',
'field_widget_edit' => TRUE,
'field_widget_remove' => TRUE,
'view_mode' => 'default',
'preview_image_style' => 'thumbnail',
'open' => TRUE,
'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND,
],
'region' => 'content',
])
->setComponent('field_hero_image', [
'type' => 'entity_browser_file',
'settings' => [
'entity_browser' => 'image_browser',
'field_widget_edit' => TRUE,
'field_widget_remove' => TRUE,
'view_mode' => 'default',
'preview_image_style' => 'thumbnail',
'open' => TRUE,
'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND,
],
'region' => 'content',
])
->setComponent('field_lightweight_image', [
'type' => 'entity_browser_file',
'settings' => [
'entity_browser' => 'image_browser',
'field_widget_edit' => TRUE,
'field_widget_remove' => TRUE,
'view_mode' => 'default',
'preview_image_style' => 'thumbnail',
'open' => TRUE,
'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND,
],
'region' => 'content',
])
->setComponent('field_unlimited_images', [
'type' => 'entity_browser_file',
'settings' => [
'entity_browser' => 'image_browser',
'field_widget_edit' => TRUE,
'field_widget_remove' => TRUE,
'view_mode' => 'default',
'preview_image_style' => 'thumbnail',
'open' => TRUE,
'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND,
],
'region' => 'content',
])
->setComponent('field_media_reference', [
'type' => 'entity_browser_entity_reference',
'settings' => [
'entity_browser' => 'media_browser',
'field_widget_display' => 'rendered_entity',
'field_widget_edit' => TRUE,
'field_widget_remove' => TRUE,
'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND,
'field_widget_display_settings' => [
'view_mode' => 'embedded',
],
'open' => TRUE,
],
'region' => 'content',
])
->save();
$display = entity_get_form_display('media', 'video', 'default');
// Add field_image to the display and save it; lightning_media_image will
// default it to the image browser widget.
$display
->setComponent('field_image', [
'type' => 'image_image',
])
->save();
// Then switch it to a standard image widget.
$display
->setComponent('field_image', [
'type' => 'image_image',
'weight' => 4,
'settings' => [
'preview_image_style' => 'thumbnail',
'progress_indicator' => 'throbber',
],
'region' => 'content',
])
->save();
}