Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi again,
When editing a module/view menú, this message appears:
Notice: Undefined index: #description in imce_menu_links_form_alter()
It's on imce_menu_links_form_alter function, and could be fixed with a condition prior to modification of link path description:
function imce_menu_links_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'menu_edit_item' || $form_id == 'og_menu_edit_item_form') {
$path = drupal_get_path('module', 'imce_menu_links');
$imcepath = drupal_get_path('module', 'imce');
drupal_add_js($path . '/imce_menu_links.js');
drupal_add_css($path . '/imce_menu_links.css');
drupal_add_js($imcepath . '/js/imce.js');
drupal_add_js($imcepath . '/js/imce_set_app.js');
drupal_add_js(array('imce_menu_links' => array('url' => url('imce'))), 'setting');
if(isset($form['link_path']) &&
isset($form['link_path']['#description'])) {
$form['link_path']['#description'] .=
' Click on the <em>Open File Browser</em> link above to link to a local file. ' .
'<em>Local files are prefixed with <file></em>.';
}
}
}
Because of the nature of this kind of menu entries, it would be still better to do nothing at all with them:
function imce_menu_links_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'menu_edit_item' || $form_id == 'og_menu_edit_item_form') {
if(isset($form['link_path']) &&
isset($form['link_path']['#description'])) {
$path = drupal_get_path('module', 'imce_menu_links');
$imcepath = drupal_get_path('module', 'imce');
drupal_add_js($path . '/imce_menu_links.js');
drupal_add_css($path . '/imce_menu_links.css');
drupal_add_js($imcepath . '/js/imce.js');
drupal_add_js($imcepath . '/js/imce_set_app.js');
drupal_add_js(array('imce_menu_links' => array('url' => url('imce'))), 'setting');
$form['link_path']['#description'] .=
' Click on the <em>Open File Browser</em> link above to link to a local file. ' .
'<em>Local files are prefixed with <file></em>.';
}
}
}
Best regards!!
emi
Comments
Comment #1
zipymonkey CreditAttribution: zipymonkey commentedComment #3
zipymonkey CreditAttribution: zipymonkey commentedAdded the check on the #description. Marking as fixed.