You are here

function create_storage_published in Modal 8.3

Same name and namespace in other branches
  1. 8.2 modal_page.install \create_storage_published()
  2. 5.0.x modal_page.install \create_storage_published()
  3. 4.0.x modal_page.install \create_storage_published()
  4. 4.1.x modal_page.install \create_storage_published()

Create the field published.

1 call to create_storage_published()
modal_page_update_8202 in ./modal_page.install
Implements hook_update_N().

File

./modal_page.install, line 165
Install, update and uninstall functions for the Modal Page.

Code

function create_storage_published() {
  $field_storage_definition = BaseFieldDefinition::create('boolean')
    ->setLabel(t("Published"))
    ->setDefaultValue(TRUE)
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'settings' => [
      'display_label' => TRUE,
    ],
    'weight' => -5,
  ]);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('published', 'modal_page_modal', 'modal_page_modal', $field_storage_definition);
}