Review search_config schema structure

Created on 21 August 2016, over 8 years ago
Updated 3 May 2024, 8 months ago

As noted in #2783667: Collapsible feature is not active β†’ , search_config.node.schema.yml was artifact of the update due to ways that the D7 version was programmed, leaving that decision for that issue.

Looking at the rest of the schema.

config/schema/search_config.stringoverrides.schema.yml

search_config.stringoverrdies:
  type: config_object
  mapping:
    search_config_string_overrides:
      type: array
      label: 'search_config_string_overrides'

Typo stringoverrdies
Schema value label is search_config_string_overrides, "An array of string overrides".

With D8, can we set all of the defaults now in config/install making the follow checks in the two helper functions redundant?

With my limited knowledge of D8, are these actually reading and writing to different settings, read search_config.settings & write search_config.node_content_settings?

All of search_config.node_content_settings values are also found in search_config.settings suggesting this could be happening.

config/install/search_config.settings.yml
config/install/search_config.node_content_settings.yml

function search_config_node_settings() {
  $search_config_settings = \Drupal::config('search_config.settings');
  $settings['forms'] = array(
    'toggle_forms' => 0,            // Show adv if both forms are present
    'move_keyword_search' => 0,     // Move keyword search into adv form
    'advanced_populate' => 0,       // Try and repopulate the adv form
    'advanced_expand' => 'default', // Control the presentation of adv form
    // Controls all 3 'Containing...' fields.
    'remove_containing_wrapper' => 'default',
  );
...

}

function search_config_string_overrides($key = NULL) {
  $overrides = \Drupal::config('search_config.stringoverrides')
    ->get('search_config_string_overrides');
  $overrides += array(
    'labels' => array(
.....
    ),
  );
  if (isset($key)) {
    return array_filter($overrides[$key]);
  }
  return $overrides;
}

function search_config_search_admin_settings_submit(&$form, &$form_state) {
  \Drupal::configFactory()
    ->getEditable('search_config.settings')
    ->set('search_config_string_overrides', $form_state['values']['search_config_string_overrides'])
    ->save();
  \Drupal::configFactory()
    ->getEditable('search_config.node_content_settings')
    ->set('search_config', $form_state['values']['content_node_search_config']);
}
πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia alan d.

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024