original_string: protected static function get_page_fields(lesson_page $page, $returncontents = false) {
          $lesson = $page->lesson;
          $context = $lesson->context;
  
          $pagedata = new stdClass; // Contains the data that will be returned by the WS.
  
          // Return the visible data.
          $visibleproperties = array('id', 'lessonid', 'prevpageid', 'nextpageid', 'qtype', 'qoption', 'layout', 'display',
                                      'displayinmenublock', 'type', 'typeid', 'typestring', 'timecreated', 'timemodified');
          foreach ($visibleproperties as $prop) {
              $pagedata->{$prop} = $page->{$prop};
          }
  
          // Check if we can see title (contents required custom rendering, we won't returning it here @see get_page_data).
          $canmanage = $lesson->can_manage();
          // If we are managers or the menu block is enabled and is a content page visible always return contents.
          if ($returncontents || $canmanage || (lesson_displayleftif($lesson) && $page->displayinmenublock && $page->display)) {
              $pagedata->title = external_format_string($page->title, $context->id);
  
              $options = array('noclean' => true);
              list($pagedata->contents, $pagedata->contentsformat) =
                  external_format_text($page->contents, $page->contentsformat, $context->id, 'mod_lesson', 'page_contents', $page->id,
                      $options);
  
          }
          return $pagedata;
      }
code: protected static function get_page_fields(lesson_page $page, $returncontents = false) {
          $lesson = $page->lesson;
          $context = $lesson->context;
  
          $pagedata = new stdClass; // Contains the data that will be returned by the WS.
  
          // Return the visible data.
          $visibleproperties = array('id', 'lessonid', 'prevpageid', 'nextpageid', 'qtype', 'qoption', 'layout', 'display',
                                      'displayinmenublock', 'type', 'typeid', 'typestring', 'timecreated', 'timemodified');
          foreach ($visibleproperties as $prop) {
              $pagedata->{$prop} = $page->{$prop};
          }
  
          // Check if we can see title (contents required custom rendering, we won't returning it here @see get_page_data).
          $canmanage = $lesson->can_manage();
          // If we are managers or the menu block is enabled and is a content page visible always return contents.
          if ($returncontents || $canmanage || (lesson_displayleftif($lesson) && $page->displayinmenublock && $page->display)) {
              $pagedata->title = external_format_string($page->title, $context->id);
  
              $options = array('noclean' => true);
              list($pagedata->contents, $pagedata->contentsformat) =
                  external_format_text($page->contents, $page->contentsformat, $context->id, 'mod_lesson', 'page_contents', $page->id,
                      $options);
  
          }
          return $pagedata;
      }
code_tokens: protected static function get_page_fields ( lesson_page $ page , $ returncontents = false ) { $ lesson = $ page -> lesson ; $ context = $ lesson -> context ; $ pagedata = new stdClass ; // Contains the data that will be returned by the WS. // Return the visible data. $ visibleproperties = array ( 'id' , 'lessonid' , 'prevpageid' , 'nextpageid' , 'qtype' , 'qoption' , 'layout' , 'display' , 'displayinmenublock' , 'type' , 'typeid' , 'typestring' , 'timecreated' , 'timemodified' ) ; foreach ( $ visibleproperties as $ prop ) { $ pagedata -> { $ prop } = $ page -> { $ prop } ; } // Check if we can see title (contents required custom rendering, we won't returning it here @see get_page_data). $ canmanage = $ lesson -> can_manage ( ) ; // If we are managers or the menu block is enabled and is a content page visible always return contents. if ( $ returncontents || $ canmanage || ( lesson_displayleftif ( $ lesson ) && $ page -> displayinmenublock && $ page -> display ) ) { $ pagedata -> title = external_format_string ( $ page -> title , $ context -> id ) ; $ options = array ( 'noclean' => true ) ; list ( $ pagedata -> contents , $ pagedata -> contentsformat ) = external_format_text ( $ page -> contents , $ page -> contentsformat , $ context -> id , 'mod_lesson' , 'page_contents' , $ page -> id , $ options ) ; } return $ pagedata ; }
docstring: Returns the fields of a page object
  @param lesson_page $page the lesson page
  @param bool $returncontents whether to return the page title and contents
  @return stdClass          the fields matching the external page structure
  @since Moodle 3.3
docstring_tokens: Returns the fields of a page object