how show id module number in menu seconday

how show id module number in menu seconday

by stephane ngov -
Number of replies: 1

I all,

I try add second menu in course, i wish help for implément .

this is a picture


activité "new forum" in a table course_module is à id number2,

I wish get this number "2" and show it for test,

in a second menu we have new url click "module 2".

I find in /lib/outputrenderers.php


    protected function render_action_menu_link_secondary(action_menu_link_secondary $action) {

      return $this->render_action_menu_link($action);
    }


how i can add in array "module $id" ?


the buld html menu is this code in the same file


    protected function render_action_menu_link(action_menu_link $action) {
        static $actioncount = 0;
        $actioncount++;

        $comparetoalt = '';
     
  
        if (!$action->icon || $action->primary === false) {
            $text .= html_writer::start_tag('span', array('class'=>'menu-action-text', 'id' => 'actionmenuaction-'.$actioncount));
            if ($action->text instanceof renderable) {
                $text .= $this->render($action->text);
            } else {
                $text .= $action->text;
                $comparetoalt = (string)$action->text;
            }
            $text .= html_writer::end_tag('span');
        }

        $icon = '';
        if ($action->icon) {
            $icon = $action->icon;
            if ($action->primary || !$action->actionmenu->will_be_enhanced()) {
                $action->attributes['title'] = $action->text;
            }
            if (!$action->primary && $action->actionmenu->will_be_enhanced()) {
                if ((string)$icon->attributes['alt'] === $comparetoalt) {
                    $icon->attributes['alt'] = '';
                }
                if (isset($icon->attributes['title']) && (string)$icon->attributes['title'] === $comparetoalt) {
                    unset($icon->attributes['title']);
                }
            }
            $icon = $this->render($icon);
        }

        // A disabled link is rendered as formatted text.
        if (!empty($action->attributes['disabled'])) {
            // Do not use div here due to nesting restriction in xhtml strict.
            return html_writer::tag('span', $icon.$text, array('class'=>'currentlink', 'role' => 'menuitem'));
        }


thans avdvance for help me


Average of ratings: -
In reply to stephane ngov

Re: how show id module number in menu seconday

by stephane ngov -

i found it, in course/lib.php i add this


        $actions['a_e'] = new action_menu_link_secondary(
                new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '1')), new pix_icon($rightarrow,'etudiant-apprenti', 'moodle', array('class' => 'iconsmall', 'title' => '')),'a_e', array('class' => 'editing_moveright ' . $enabledclass, 'data-action' => 'a_e', 'data-keepopen' => true)
        );

now i have link "a_e",

is it possible have the same link add 2 icone link ?


icone1 and icone 2 i want execute directely query sql