php - Can you alter the content of $OUTPUT->main_content() in moodle? -


i'm aware of similar questions related this. task more complex css can handle.

in 1 of course templates, example, whole content area of page seems handled 3 lines of code...

        echo $output->course_content_header();         echo $output->main_content();         echo $output->course_content_footer(); 

suppose need add major changes inner content of course. requires restructuring markup, data, etc handled $output->main_content()

other answers trace libs/outputrenderers.php if find this:

public function main_content() {     // here because place can inject "main" role on entire main content area     // without requiring theme's manually it, , without creating yet thing people need     // remember in theme.     // unfortunate hack. no ever add more here.     // not add classes.     // not add id.      return '<div role="main">'.$this->unique_main_content_token.'</div>'; } 

... trace $this->unique_main_content_token , nothing well.

somewhere, in mess, there must that's assembling data , markup. don't need override main_content() function in child theme. give me blank slate. need know how it's pulling data generate page can access things course titles, user status, etc. , additionally inject own modifications belong opposed trying meddle css absolute positioning or post load js manipulation. i'll dirty if have to, i'd rather understand system before have chop bits.

does know find html of $output->main_content() handled, in general or courses?

moodle works call "renderers". method main_content way themers indicate main content rendered in theme.

the way moodle renders pages letting developer echo want after first call $output->header(), have end output $output->footer(). under hood, layout file provided themer split in two, 1 part echoed $output->header(), , rest $outout->footer().

so unfortunately won't able catch of content, except perhaps if override methods mentioned above , introduce own output buffering. though, convention output should generated renderers can override in theme. regardless of solution you're heading for, theme start.

also depending on trying achieve, instance changing layout of course, may better of looking @ other plugin types, such "course formats".

i hope helped.

to clarify, override renderer must create new theme, , create renderer class. if want override more core renderers, renderers of plugins mod_scorm, must create renderer class of specific name.

examples:

class theme_yourtheme_core_renderer extends core_renderer {      // overridden core renderer methods here. } class theme_yourtheme_mod_scorm_renderer extends mod_scorm_renderer {     // overridden scorm renderer methods here. } 

i suggest read documentation below, confusing may be. recommend skim through code of other themes have been pretty creative uses of renderers.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -