Browse Source

Index `field_weight`'s value. (#924)

pull/928/head
Adam 2 years ago committed by GitHub
parent
commit
fe7e450a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml
  2. 20
      modules/islandora_core_feature/islandora_core_feature.post_update.php

4
modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml

@ -14,6 +14,8 @@ module: core
locked: false locked: false
cardinality: 1 cardinality: 1
translatable: true translatable: true
indexes: { } indexes:
value:
- value
persist_with_no_fields: false persist_with_no_fields: false
custom_storage: false custom_storage: false

20
modules/islandora_core_feature/islandora_core_feature.post_update.php

@ -0,0 +1,20 @@
<?php
/**
* @file
* Post-update hooks.
*/
/**
* Add index to field_weight.
*/
function islandora_core_feature_post_update_add_index_to_field_weight() {
$storage = \Drupal::entityTypeManager()->getStorage('field_storage_config');
$field = $storage->load('node.field_weight');
$indexes = $field->getIndexes();
$indexes += [
'value' => ['value'],
];
$field->setIndexes($indexes);
$field->save();
}
Loading…
Cancel
Save