original_string: public function add_menu_actions(structure $structure, $page, \moodle_url $pageurl,
              \question_edit_contexts $contexts, array $pagevars) {
  
          $actions = $this->edit_menu_actions($structure, $page, $pageurl, $pagevars);
          if (empty($actions)) {
              return '';
          }
          $menu = new \action_menu();
          $menu->set_alignment(\action_menu::TR, \action_menu::TR);
          $menu->set_constraint('.mod-quiz-edit-content');
          $trigger = html_writer::tag('span', get_string('add', 'quiz'), array('class' => 'add-menu'));
          $menu->set_menu_trigger($trigger);
          // The menu appears within an absolutely positioned element causing width problems.
          // Make sure no-wrap is set so that we don't get a squashed menu.
          $menu->set_nowrap_on_items(true);
  
          // Disable the link if quiz has attempts.
          if (!$structure->can_be_edited()) {
              return $this->render($menu);
          }
  
          foreach ($actions as $action) {
              if ($action instanceof \action_menu_link) {
                  $action->add_class('add-menu');
              }
              $menu->add($action);
          }
          $menu->attributes['class'] .= ' page-add-actions commands';
  
          // Prioritise the menu ahead of all other actions.
          $menu->prioritise = true;
  
          return $this->render($menu);
      }
code: public function add_menu_actions(structure $structure, $page, \moodle_url $pageurl,
              \question_edit_contexts $contexts, array $pagevars) {
  
          $actions = $this->edit_menu_actions($structure, $page, $pageurl, $pagevars);
          if (empty($actions)) {
              return '';
          }
          $menu = new \action_menu();
          $menu->set_alignment(\action_menu::TR, \action_menu::TR);
          $menu->set_constraint('.mod-quiz-edit-content');
          $trigger = html_writer::tag('span', get_string('add', 'quiz'), array('class' => 'add-menu'));
          $menu->set_menu_trigger($trigger);
          // The menu appears within an absolutely positioned element causing width problems.
          // Make sure no-wrap is set so that we don't get a squashed menu.
          $menu->set_nowrap_on_items(true);
  
          // Disable the link if quiz has attempts.
          if (!$structure->can_be_edited()) {
              return $this->render($menu);
          }
  
          foreach ($actions as $action) {
              if ($action instanceof \action_menu_link) {
                  $action->add_class('add-menu');
              }
              $menu->add($action);
          }
          $menu->attributes['class'] .= ' page-add-actions commands';
  
          // Prioritise the menu ahead of all other actions.
          $menu->prioritise = true;
  
          return $this->render($menu);
      }
code_tokens: public function add_menu_actions ( structure $ structure , $ page , \ moodle_url $ pageurl , \ question_edit_contexts $ contexts , array $ pagevars ) { $ actions = $ this -> edit_menu_actions ( $ structure , $ page , $ pageurl , $ pagevars ) ; if ( empty ( $ actions ) ) { return '' ; } $ menu = new \ action_menu ( ) ; $ menu -> set_alignment ( \ action_menu :: TR , \ action_menu :: TR ) ; $ menu -> set_constraint ( '.mod-quiz-edit-content' ) ; $ trigger = html_writer :: tag ( 'span' , get_string ( 'add' , 'quiz' ) , array ( 'class' => 'add-menu' ) ) ; $ menu -> set_menu_trigger ( $ trigger ) ; // The menu appears within an absolutely positioned element causing width problems. // Make sure no-wrap is set so that we don't get a squashed menu. $ menu -> set_nowrap_on_items ( true ) ; // Disable the link if quiz has attempts. if ( ! $ structure -> can_be_edited ( ) ) { return $ this -> render ( $ menu ) ; } foreach ( $ actions as $ action ) { if ( $ action instanceof \ action_menu_link ) { $ action -> add_class ( 'add-menu' ) ; } $ menu -> add ( $ action ) ; } $ menu -> attributes [ 'class' ] .= ' page-add-actions commands' ; // Prioritise the menu ahead of all other actions. $ menu -> prioritise = true ; return $ this -> render ( $ menu ) ; }
docstring: Returns the add menu that is output once per page.
  @param structure $structure object containing the structure of the quiz.
  @param int $page the page number that this menu will add to.
  @param \moodle_url $pageurl the canonical URL of this page.
  @param \question_edit_contexts $contexts the relevant question bank contexts.
  @param array $pagevars the variables from {@link \question_edit_setup()}.
  @return string HTML to output.
docstring_tokens: Returns the add menu that is output once per page .