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 &lt;file&gt;</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 &lt;file&gt;</em>.';
    }
  }
}

Best regards!!
emi

Comments

zipymonkey’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Assigned: Unassigned » zipymonkey

  • d6bbfef committed on 7.x-1.x
    Issue #2406691 by zipymonkey,emi_bcn: Fix 'Notice: Undefined index: #...
zipymonkey’s picture

Status: Active » Fixed

Added the check on the #description. Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.