You are here

function title_menu in Title 7

Implements hook_menu().

File

./title.module, line 659

Code

function title_menu() {
  $items = array();
  foreach (entity_get_info() as $entity_type => $entity_info) {
    if (!empty($entity_info['field replacement'])) {
      foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {

        // Blindly taken from field_ui_menu().
        if (isset($bundle_info['admin'])) {
          $path = $bundle_info['admin']['path'];
          if (isset($bundle_info['admin']['bundle argument'])) {
            $bundle_arg = $bundle_info['admin']['bundle argument'];
          }
          else {
            $bundle_arg = $bundle_name;
          }
          $access = array_intersect_key($bundle_info['admin'], drupal_map_assoc(array(
            'access callback',
            'access arguments',
          )));
          $access += array(
            'access callback' => 'user_access',
            'access arguments' => array(
              'administer site configuration',
            ),
          );
          $path = "{$path}/fields/replace/%";
          $field_arg = substr_count($path, '/');
          $items[$path] = array(
            'load arguments' => array(),
            'title' => 'Replace fields',
            'page callback' => 'drupal_get_form',
            'page arguments' => array(
              'title_field_replacement_form',
              $entity_type,
              $bundle_arg,
              $field_arg,
            ),
            'file' => 'title.admin.inc',
          ) + $access;
        }
      }
    }
  }
  $items['admin/config/content/title'] = array(
    'title' => 'Title settings',
    'description' => 'Settings for the Title module.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'title_admin_settings_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'title.admin.inc',
  );
  return $items;
}