original_string: protected function format_button_images() {
  
          foreach ($this->additionalbuttons as $buttontype => $button) {
              $page = $button['page'];
              // If no image is provided then just use the title.
              if (!isset($button['image'])) {
                  $this->additionalbuttons[$buttontype]['formattedimage'] = $button['title'];
              } else {
                  // Check to see if this is an internal Moodle icon.
                  $internalimage = $page->theme->resolve_image_location('t/' . $button['image'], 'moodle');
                  if ($internalimage) {
                      $this->additionalbuttons[$buttontype]['formattedimage'] = 't/' . $button['image'];
                  } else {
                      // Treat as an external image.
                      $this->additionalbuttons[$buttontype]['formattedimage'] = $button['image'];
                  }
              }
  
              if (isset($button['linkattributes']['class'])) {
                  $class = $button['linkattributes']['class'] . ' btn';
              } else {
                  $class = 'btn';
              }
              // Add the bootstrap 'btn' class for formatting.
              $this->additionalbuttons[$buttontype]['linkattributes'] = array_merge($button['linkattributes'],
                      array('class' => $class));
          }
      }
code: protected function format_button_images() {
  
          foreach ($this->additionalbuttons as $buttontype => $button) {
              $page = $button['page'];
              // If no image is provided then just use the title.
              if (!isset($button['image'])) {
                  $this->additionalbuttons[$buttontype]['formattedimage'] = $button['title'];
              } else {
                  // Check to see if this is an internal Moodle icon.
                  $internalimage = $page->theme->resolve_image_location('t/' . $button['image'], 'moodle');
                  if ($internalimage) {
                      $this->additionalbuttons[$buttontype]['formattedimage'] = 't/' . $button['image'];
                  } else {
                      // Treat as an external image.
                      $this->additionalbuttons[$buttontype]['formattedimage'] = $button['image'];
                  }
              }
  
              if (isset($button['linkattributes']['class'])) {
                  $class = $button['linkattributes']['class'] . ' btn';
              } else {
                  $class = 'btn';
              }
              // Add the bootstrap 'btn' class for formatting.
              $this->additionalbuttons[$buttontype]['linkattributes'] = array_merge($button['linkattributes'],
                      array('class' => $class));
          }
      }
code_tokens: protected function format_button_images ( ) { foreach ( $ this -> additionalbuttons as $ buttontype => $ button ) { $ page = $ button [ 'page' ] ; // If no image is provided then just use the title. if ( ! isset ( $ button [ 'image' ] ) ) { $ this -> additionalbuttons [ $ buttontype ] [ 'formattedimage' ] = $ button [ 'title' ] ; } else { // Check to see if this is an internal Moodle icon. $ internalimage = $ page -> theme -> resolve_image_location ( 't/' . $ button [ 'image' ] , 'moodle' ) ; if ( $ internalimage ) { $ this -> additionalbuttons [ $ buttontype ] [ 'formattedimage' ] = 't/' . $ button [ 'image' ] ; } else { // Treat as an external image. $ this -> additionalbuttons [ $ buttontype ] [ 'formattedimage' ] = $ button [ 'image' ] ; } } if ( isset ( $ button [ 'linkattributes' ] [ 'class' ] ) ) { $ class = $ button [ 'linkattributes' ] [ 'class' ] . ' btn' ; } else { $ class = 'btn' ; } // Add the bootstrap 'btn' class for formatting. $ this -> additionalbuttons [ $ buttontype ] [ 'linkattributes' ] = array_merge ( $ button [ 'linkattributes' ] , array ( 'class' => $ class ) ) ; } }
docstring: Adds an array element for a formatted image.
docstring_tokens: Adds an array element for a formatted image .