You are here

function textimage_menu in Textimage 7.2

Same name and namespace in other branches
  1. 5.2 textimage.module \textimage_menu()
  2. 5 textimage.module \textimage_menu()
  3. 6.2 textimage.module \textimage_menu()
  4. 7.3 textimage.module \textimage_menu()

Implements hook_menu().

File

./textimage.module, line 147
Provides text to image manipulations.

Code

function textimage_menu() {
  $items = array();
  $items[file_build_uri('/textimage')] = array(
    'page callback' => 'textimage_image',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/media/textimage'] = array(
    'title' => 'Textimage',
    'description' => 'Configure text to image preset functions.',
    'page callback' => 'textimage_preset_list',
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'textimage.admin.inc',
  );
  $items['admin/config/media/textimage/preset'] = array(
    'title' => 'Presets',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/media/textimage/preset/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/media/textimage/preset/new'] = array(
    'title' => 'New',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'textimage_preset_edit',
      'new',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
    'file' => 'textimage.admin.inc',
  );
  $items['admin/config/media/textimage/preset/%/edit'] = array(
    'title' => 'Edit Preset',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'textimage_preset_edit',
      'edit',
      5,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'file' => 'textimage.admin.inc',
  );
  $items['admin/config/media/textimage/preset/%/delete'] = array(
    'title' => 'Delete Preset',
    'load arguments' => array(
      5,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'textimage_preset_delete_confirm',
      5,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'file' => 'textimage.admin.inc',
  );
  $items['admin/config/media/textimage/preset/%/flush'] = array(
    'title' => 'Flush Preset Cache',
    'load arguments' => array(
      5,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'textimage_preset_flush_confirm',
      5,
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'file' => 'textimage.admin.inc',
  );
  $items['admin/config/media/textimage/settings'] = array(
    'title' => 'Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'textimage_settings_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'weight' => 0,
    'type' => MENU_LOCAL_TASK,
    'file' => 'textimage.admin.inc',
  );

  // Generate image derivatives of publicly available files, via
  // URL request path. For local default filesystem only.
  $stream_wrapper = file_stream_wrapper_get_instance_by_scheme(variable_get('file_default_scheme', 'public'));
  if ($stream_wrapper instanceof DrupalLocalStreamWrapper) {
    $directory_path = $stream_wrapper
      ->getDirectoryPath();
    $directory_count = count(explode('/', $directory_path));
    $items[$directory_path . '/textimage'] = array(
      'title' => 'Generate textimage',
      'page callback' => 'textimage_deliver',
      'page arguments' => array(
        $directory_count + 1,
        $directory_count + 2,
      ),
      'access arguments' => array(
        'create textimages',
      ),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}