Answer the question
In order to leave comments, you need to log in
Is there any limit on path length in drupal 7 hook_menu?
Hello!
Can someone tell me why the last callback in the code does not work? Does drupal have any restrictions on path length???
function image_watermark_menu() {
$items = array();
$items['admin/config/media/image_watermark/config_form'] = array(
'title' => 'Image watermark settings',
'description' => 'Image watermark settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('image_watermark_config_form'),
'access arguments' => array('administer site configuration'),
'file' => 'image_watermark.admin.inc',
);
$directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
$count = count(explode('/', $directory_path));
$items[$directory_path . '/styles/%image_style/public/image_watermark_move'] = array(
'title' => 'Generate image style',
'page callback' => 'image_watermark_style_deliver',
'page arguments' => array($count + 1, $count + 2, $count + 3, $count + 4),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items[$directory_path . '/styles/%image_style/public/image_watermark_no_watermark'] = array(
'title' => 'Generate image style',
'page callback' => 'image_watermark_style_deliver',
'page arguments' => array($count + 1, $count + 2, $count + 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items[$directory_path . '/styles/%image_style/public/image_watermark/private/field/image'] = array(
'title' => 'Generate image style',
'page callback' => 'image_watermark_style_deliver',
'page arguments' => array($count + 1, $count + 2, $count + 3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
Answer the question
In order to leave comments, you need to log in
In the database, the path field is varchar(255) - that's all the restrictions
things turned out to be in the kernel constant MENU_MAX_PARTS = 9. and unfortunately there is no way to change the situation with the number of elements in the path ((
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question