diff --git a/openy_taxonomy/modules/openy_txnm_amenities/config/install/field.field.taxonomy_term.amenities.field_amenities_icon.yml b/openy_taxonomy/modules/openy_txnm_amenities/config/install/field.field.taxonomy_term.amenities.field_amenities_icon.yml index 13e1c9ca..d304b662 100644 --- a/openy_taxonomy/modules/openy_txnm_amenities/config/install/field.field.taxonomy_term.amenities.field_amenities_icon.yml +++ b/openy_taxonomy/modules/openy_txnm_amenities/config/install/field.field.taxonomy_term.amenities.field_amenities_icon.yml @@ -12,7 +12,7 @@ entity_type: taxonomy_term bundle: amenities label: Icon description: 'Icon will be displayed on Amenities page. Find 1 million of free SVG icons at thenounproject.com' -required: true +required: false translatable: false default_value: { } default_value_callback: '' diff --git a/openy_taxonomy/modules/openy_txnm_amenities/openy_txnm_amenities.install b/openy_taxonomy/modules/openy_txnm_amenities/openy_txnm_amenities.install index 5dcb464a..7f198089 100644 --- a/openy_taxonomy/modules/openy_txnm_amenities/openy_txnm_amenities.install +++ b/openy_taxonomy/modules/openy_txnm_amenities/openy_txnm_amenities.install @@ -24,3 +24,25 @@ function openy_txnm_amenities_update_8001() { } } } + +/** + * Set amenities icon as not required. + */ +function openy_txnm_amenities_update_9001() +{ + $config_dir = \Drupal::service('extension.list.module')->getPath('openy_txnm_amenities') . '/config/install/'; + // Update multiple configurations. + $configs = [ + 'field.field.taxonomy_term.amenities.field_amenities_icon' => [ + 'required', + ], + ]; + + $config_updater = \Drupal::service('openy_upgrade_tool.param_updater'); + foreach ($configs as $config_name => $params) { + $config = $config_dir . $config_name . '.yml'; + foreach ($params as $param) { + $config_updater->update($config, $config_name, $param); + } + } +} \ No newline at end of file