diff --git a/ebt_bootstrap_button.install b/ebt_bootstrap_button.install new file mode 100644 index 0000000000000000000000000000000000000000..fb179173ab45023e046ff45407036a9fe18145b8 --- /dev/null +++ b/ebt_bootstrap_button.install @@ -0,0 +1,30 @@ +<?php + +/** + * @file + * Install, update and uninstall logic for EBT Bootstrap Button. + */ + +use Drupal\field\Entity\FieldConfig; + +/** + * Set the field "field_ebt_bootstrap_button_link" as required. + */ +function ebt_bootstrap_button_update_9101() { + + // Set the machine names. + $block_type_id = 'ebt_bootstrap_button'; + $field_name = 'field_ebt_bootstrap_button_link'; + + // Load the field configuration object. + $field_config = FieldConfig::loadByName('block_content', $block_type_id, $field_name); + + // If the field doesn't exists, skip. + if (empty($field_config)) { + return; + } + + // Set the field as required. + $field_config->setRequired(TRUE)->save(); + +}