You are here

function resp_img_menu in Responsive images and styles 7.2

Same name and namespace in other branches
  1. 7 resp_img.module \resp_img_menu()

Implements hook_menu().

File

./resp_img.module, line 22

Code

function resp_img_menu() {
  $items = array();

  // @todo: link to all breakpoints and a list of all groups
  // cf theme settings page
  $items['admin/config/media/resp_img'] = array(
    'title' => 'Responsive images and styles',
    'description' => 'Manage Responsive Images and Styles',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'resp_img_admin_breakpoints',
    ),
    'access arguments' => array(
      'administer responsive images and styles',
    ),
    'file' => 'resp_img.admin.inc',
  );
  $items['admin/config/media/resp_img/groups'] = array(
    'title' => 'Groups',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 10,
  );
  $items['admin/config/media/resp_img/groups/global'] = array(
    'title' => 'Map breakpoints and image styles',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/config/media/resp_img/groups/import'] = array(
    'title' => 'Import mappings',
    'page arguments' => array(
      'resp_img_admin_import_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer responsive images and styles',
    ),
    'file' => 'resp_img.admin.inc',
    'weight' => 999,
  );
  $breakpoint_groups = breakpoints_breakpoint_group_load_all();
  foreach ($breakpoint_groups as $breakpoint_group_name => $breakpoint_group) {
    if (!empty($breakpoint_group->machine_name)) {
      $items['admin/config/media/resp_img/groups/' . $breakpoint_group->machine_name] = array(
        'title' => $breakpoint_group->name,
        'page arguments' => array(
          'resp_img_admin_breakpoints',
          $breakpoint_group->machine_name,
        ),
        'type' => MENU_LOCAL_TASK,
        'access arguments' => array(
          'administer responsive images and styles',
        ),
        'file' => 'resp_img.admin.inc',
        'weight' => 15,
      );
      $items['admin/config/media/resp_img/groups/' . $breakpoint_group->machine_name . '/export'] = array(
        'title' => 'Export ' . check_plain($breakpoint_group->name) . ' mappings',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'resp_img_admin_export_form',
          'mappings.' . $breakpoint_group->machine_name,
        ),
        'type' => MENU_LOCAL_ACTION,
        'access arguments' => array(
          'administer responsive images and styles',
          'mappings.' . $breakpoint_group->machine_name,
        ),
        'access callback' => 'resp_img_mappings_export_access',
        'file' => 'resp_img.admin.inc',
        'weight' => 15,
      );
    }
  }
  return $items;
}