public static function PathBreadcrumbsUIAutocomplete::applyDataSelector in Path Breadcrumbs 7.3
1 call to PathBreadcrumbsUIAutocomplete::applyDataSelector()
- PathBreadcrumbsUIAutocomplete::processAutocomplete in path_breadcrumbs_ui/
includes/ path_breadcrumbs_ui.autocomplete.inc
File
- path_breadcrumbs_ui/
includes/ path_breadcrumbs_ui.autocomplete.inc, line 45 - Path breadcrumbs UI autocomplete.
Class
- PathBreadcrumbsUIAutocomplete
- @file Path breadcrumbs UI autocomplete.
Code
public static function applyDataSelector($selector, $context_keywords) {
$parts = explode(':', str_replace('-', '_', $selector), 2);
if (isset($context_keywords[$parts[0]])) {
// Wrap required entity with metadata wrapper.
$context_type = $context_keywords[$parts[0]];
$info = PathBreadcrumbsUIAutocomplete::getEntityInfo($context_type);
$wrapper = entity_metadata_wrapper($context_type, NULL, $info);
if (count($parts) > 1 && $wrapper instanceof EntityMetadataWrapper) {
try {
foreach (explode(':', $parts[1]) as $name) {
if ($wrapper instanceof EntityListWrapper || $wrapper instanceof EntityStructureWrapper) {
$wrapper = $wrapper
->get($name);
}
else {
return FALSE;
}
}
} catch (EntityMetadataWrapperException $e) {
return FALSE;
}
}
}
return isset($wrapper) ? $wrapper : FALSE;
}