You are here

function field_tools_field_page in Field tools 8

Same name and namespace in other branches
  1. 7 field_tools.admin.inc \field_tools_field_page()

Page callback to list all instances of a field with links to edit them.

1 string reference to 'field_tools_field_page'
D7field_tools_menu in ./field_tools.module
Implements hook_menu().

File

./field_tools.admin.inc, line 960
NOTICE: THIS FILE IS OBSOLETE. IT IS BEING KEPT UNTIL ALL FUNCTIONALITY IS PORTED TO DRUPAL 8.

Code

function field_tools_field_page($field_name) {
  $field = field_info_field($field_name);
  if (!$field) {
    return t('No field found.');
  }

  //dsm($field);
  $field_instance_list = field_tools_info_instances($field_name);
  $bundles = field_info_bundles();
  $items = array();
  foreach ($field_instance_list as $entity_type => $bundle_list) {
    foreach ($bundle_list as $bundle) {
      $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);
      $items[] = l($bundles[$entity_type][$bundle]['label'], $admin_path . '/fields/' . $field_name);
    }
  }
  return theme('item_list', array(
    'items' => $items,
  ));
}