Filter translatable definitions.
array $search_properties: Search properties that are going to be used for the filter.
\Drupal\Core\Entity\EntityTypeInterface[] Array of translatable definitions.
public function getFilteredSimpleConfigDefinitions($search_properties = array()) {
$definitions = \Drupal::service('plugin.manager.config_translation.mapper')
->getDefinitions();
$definitions = array_filter($definitions, function ($definition) use ($search_properties) {
if (isset($definition['entity_type'])) {
return FALSE;
}
if (isset($search_properties['name']) && strpos(strtolower($definition['title']), strtolower($search_properties['name'])) === FALSE) {
return FALSE;
}
if (isset($search_properties['target_language'])) {
if ($search_properties['target_status'] == 'translated' && !$this
->isTranslated($search_properties['target_language'], $definition['names'][0])) {
return FALSE;
}
if ($search_properties['target_status'] == 'untranslated' && $this
->isTranslated($search_properties['target_language'], $definition['names'][0])) {
return FALSE;
}
}
return TRUE;
});
return $definitions;
}