You are here

function modal_page_update_8205 in Modal 5.0.x

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

Create Auto Open Feature.

File

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

Code

function modal_page_update_8205() {
  $field_storage_definition = BaseFieldDefinition::create('boolean')
    ->setLabel(t("Auto Open"))
    ->setDefaultValue(TRUE)
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'settings' => [
      'display_label' => TRUE,
    ],
    'weight' => -5,
  ]);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('auto_open', 'modal_page_modal', 'modal_page_modal', $field_storage_definition);
  $field_to_be_updated = [
    'auto_open' => TRUE,
  ];
  modal_page_update_modal_table($field_to_be_updated);
  \Drupal::service('cache.render')
    ->invalidateAll();
}