Skip to content

Commit

Permalink
Add required property to default settings.
Browse files Browse the repository at this point in the history
Also, implement post-update hook to populate the value in existing installations,
just in case.
  • Loading branch information
adam-vessey committed Feb 5, 2025
1 parent 8db4c55 commit e83ac38
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/install/jsonld.settings.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
remove_jsonld_format: false
rdf_namespaces: []
17 changes: 17 additions & 0 deletions jsonld.post_update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* @file
* Post-update hook implementations.
*/

/**
* Ensure `rdf_namespaces` exists.
*/
function jsonld_post_update_ensure_rdf_namespaces_exists() : void {
$config = \Drupal::configFactory()->getEditable('jsonld.settings');

if ($config->get('rdf_namespaces') === NULL) {
$config->set('rdf_namespaces', [])->save();
}
}

0 comments on commit e83ac38

Please sign in to comment.