You are here

function _potx_find_matching_schema_candidates in Translation template extractor 8

Same name and namespace in other branches
  1. 7.3 potx.inc \_potx_find_matching_schema_candidates()

Finds the possible schema keys that match with a config element name.

Parameters

string $name: Name of the config element.

1 call to _potx_find_matching_schema_candidates()
_potx_parse_shipped_configuration in ./potx.inc
Parse shipped configuration for translatables. Drupal 8+.

File

./potx.inc, line 2614
Extraction API used by the web and command line interface.

Code

function _potx_find_matching_schema_candidates($name) {
  $candidates = [
    $name,
  ];
  $replaced = preg_replace('/([^.:]+)([.:*]*)$/', '*\\2', $name);
  if ($replaced != $name) {
    $candidates[] = $replaced;
    $one_star = preg_replace('/\\.([:.*]*)$/', '.*', $replaced);
    if ($one_star != $replaced) {
      $candidates[] = $one_star;
    }
    $candidates = array_merge($candidates, _potx_find_matching_schema_candidates($replaced));
    $candidates = array_unique($candidates);
  }
  return $candidates;
}