Commit cb7cd262 authored by webchick's avatar webchick

Issue #2160159 by yched: Remove useless D7 field_ui menu loader callback.

parent 4910e432
...@@ -91,51 +91,6 @@ function field_ui_permission() { ...@@ -91,51 +91,6 @@ function field_ui_permission() {
return $permissions; return $permissions;
} }
/**
* Menu loader callback: Loads a field instance based on field and bundle name.
*
* @param $field_name
* The name of the field, as contained in the path.
* @param $entity_type
* The name of the entity.
* @param $bundle_name
* The name of the bundle, as contained in the path.
* @param $bundle_pos
* The position of $bundle_name in $map.
* @param $map
* The translated menu router path argument map.
*
* @return
* The field instance array.
*
* @ingroup field
*/
function field_ui_instance_load($field_name, $entity_type, $bundle_name, $bundle_pos, $map) {
// Extract the actual bundle name from the translated argument map.
// The menu router path to manage fields of an entity can be shared among
// multiple bundles. For example:
// - admin/structure/types/manage/%node_type/fields/%field_ui_instance
// - admin/structure/types/manage/%comment_node_type/fields/%field_ui_instance
// The menu system will automatically load the correct bundle depending on the
// actual path arguments, but this menu loader function only receives the node
// type string as $bundle_name, which is not the bundle name for comments.
// We therefore leverage the dynamically translated $map provided by the menu
// system to retrieve the actual bundle and bundle name for the current path.
if ($bundle_pos > 0) {
$bundle = $map[$bundle_pos];
$bundle_name = field_extract_bundle($entity_type, $bundle);
}
// Check whether the field exists at all.
if ($field = field_info_field($entity_type, $field_name)) {
// Only return the field if a field instance exists for the given entity
// type and bundle.
if ($instance = field_info_instance($entity_type, $field_name, $bundle_name)) {
return $instance;
}
}
return FALSE;
}
/** /**
* Implements hook_theme(). * Implements hook_theme().
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment