original_string: public function render_print_book_chapter($chapter, $chapters, $book, $cm) {
          global $OUTPUT;
  
          $context = context_module::instance($cm->id);
          $title = book_get_chapter_title($chapter->id, $chapters, $book, $context);
  
          $chaptervisible = $chapter->hidden ? false : true;
  
          $bookchapter = '';
          $bookchapter .= html_writer::start_div('book_chapter p-t-1', ['id' => 'ch' . $chapter->id]);
          if (!$book->customtitles) {
              if (!$chapter->subchapter) {
                  $bookchapter .= $OUTPUT->heading($title, 2, 'text-center p-b-2');
              } else {
                  $bookchapter .= $OUTPUT->heading($title, 3, 'text-center p-b-2');
              }
          }
  
          $chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id,
              'mod_book', 'chapter', $chapter->id);
          $bookchapter .= format_text($chaptertext, $chapter->contentformat, array('noclean' => true, 'context' => $context));
          $bookchapter .= html_writer::end_div();
  
          return array($bookchapter, $chaptervisible);
      }
code: public function render_print_book_chapter($chapter, $chapters, $book, $cm) {
          global $OUTPUT;
  
          $context = context_module::instance($cm->id);
          $title = book_get_chapter_title($chapter->id, $chapters, $book, $context);
  
          $chaptervisible = $chapter->hidden ? false : true;
  
          $bookchapter = '';
          $bookchapter .= html_writer::start_div('book_chapter p-t-1', ['id' => 'ch' . $chapter->id]);
          if (!$book->customtitles) {
              if (!$chapter->subchapter) {
                  $bookchapter .= $OUTPUT->heading($title, 2, 'text-center p-b-2');
              } else {
                  $bookchapter .= $OUTPUT->heading($title, 3, 'text-center p-b-2');
              }
          }
  
          $chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id,
              'mod_book', 'chapter', $chapter->id);
          $bookchapter .= format_text($chaptertext, $chapter->contentformat, array('noclean' => true, 'context' => $context));
          $bookchapter .= html_writer::end_div();
  
          return array($bookchapter, $chaptervisible);
      }
code_tokens: public function render_print_book_chapter ( $ chapter , $ chapters , $ book , $ cm ) { global $ OUTPUT ; $ context = context_module :: instance ( $ cm -> id ) ; $ title = book_get_chapter_title ( $ chapter -> id , $ chapters , $ book , $ context ) ; $ chaptervisible = $ chapter -> hidden ? false : true ; $ bookchapter = '' ; $ bookchapter .= html_writer :: start_div ( 'book_chapter p-t-1' , [ 'id' => 'ch' . $ chapter -> id ] ) ; if ( ! $ book -> customtitles ) { if ( ! $ chapter -> subchapter ) { $ bookchapter .= $ OUTPUT -> heading ( $ title , 2 , 'text-center p-b-2' ) ; } else { $ bookchapter .= $ OUTPUT -> heading ( $ title , 3 , 'text-center p-b-2' ) ; } } $ chaptertext = file_rewrite_pluginfile_urls ( $ chapter -> content , 'pluginfile.php' , $ context -> id , 'mod_book' , 'chapter' , $ chapter -> id ) ; $ bookchapter .= format_text ( $ chaptertext , $ chapter -> contentformat , array ( 'noclean' => true , 'context' => $ context ) ) ; $ bookchapter .= html_writer :: end_div ( ) ; return array ( $ bookchapter , $ chaptervisible ) ; }
docstring: Render the print book chapter.
  
  @param object $chapter The book chapter object
  @param array $chapters The array of book chapters
  @param object $book The book object
  @param object $cm The course module object
  @return array The array containing the content of the book chapter and visibility information
docstring_tokens: Render the print book chapter .