You are here

test_10a21ffe.install in Lightning Media 8.2

Same filename and directory in other branches
  1. 8 tests/modules/test_10a21ffe/test_10a21ffe.install

File

tests/modules/test_10a21ffe/test_10a21ffe.install
View source
<?php

use Drupal\entity_browser\Element\EntityBrowserElement;
use Drupal\field\Entity\FieldConfig;

/**
 * Implements hook_install().
 */
function test_10a21ffe_install() {
  entity_get_form_display('node', 'page', 'default')
    ->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',
  ])
    ->save();
}

/**
 * Implements hook_uninstall().
 */
function test_10a21ffe_uninstall() {
  FieldConfig::loadByName('node', 'page', 'field_hero_image')
    ->delete();
  field_purge_batch(10);
}

Functions