1

i hope you understood the title of my topic because i have difficulties to express this problem in english.

I would like to change the menu item which is a tab (saved searches) and put it on my menu block.

enter image description here

So i went to the files of the module and found this:

search_api_saved_searches.module

$items['user/%user/saved-searches'] = array(
'title' => 'Saved searches',
'description' => 'View and edit your saved searches.',
'page callback' => 'search_api_saved_searches_user_listing',
'page arguments' => array(1),
'access callback' => 'search_api_saved_search_edit_access',
'access arguments' => array(1),
'weight' => 5,
'type' => MENU_LOCAL_TASK,
'file' => 'search_api_saved_searches.pages.inc',
);

I know that MENU_LOCAL_TASK is a generally a tab, so i tried MENU_NORMAL_ITEM but it didn't work.

I tried some other thing and removed %user $items['user/saved-searches'] but after that i had many error, i tried to debug them but after many hours i stopped, it was clearly not a good solution to change code directly on a module.

So my question is: Is there a easy way to move a menu item from a tab to a menu block when the path has a wildcard components ? If it's not possible, do you think there is, maybe, a workaround to accomplish what i want to do?

Thanks,

1

i used views to achieve what i wanted to do but it was not easy because :

  • Fields was not the same and didn't have the good format
  • There was no filter "current user" So i create a custom template using views-view-table.tpl.php.

I don't know if what i did is very good:

  • I call global $user in my template, maybe it's a mistake, i don't know if we can do that Thxs to criticguy, i improved the following code by removing current user test

     <?php foreach ($rows as $row_count => $row): ?>
        <tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"';  } ?>>
        <?php foreach ($row as $field => $content): ?>
         <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php print drupal_attributes($field_attributes[$field][$row_count]); ?>>
         <?php if($field == 'last_execute') : ?>
           <?php $last_execute = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $content))); ?>
             <?php print $last_execute; ?>
           <?php elseif($field == 'created'): ?>    
             <?php $created = format_date($content, 'short'); ?>
             <?php print $created; ?>
           <?php elseif($field == 'notify_interval'): ?>    
             <?php $interval = format_interval($content, 1); ?>
              <?php print $interval; ?>
           <?php elseif($field == 'results'): ?>  
              <?php $tab = explode(',', $content); ?>
              <?php $x = 1 ?>
              <ul>
              <?php foreach($tab as $value): ?>
                <li>
                <?php print '<a href="'.url().'node/'.$value.'">Resultat '.$x.'</a>'; ?>
                </li>
                <?php $x++ ?>
              <?php endforeach ?>
              </ul> 
           <?php else: ?>
            <?php print $content; ?>    
           <?php endif ?>
      </td>
    <?php endforeach; ?>
    

Final result: saved search I'm always interested by my question about MENU_NORMAL_ITEM and MENU_LOCAL_TASK.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.