Issue Bug Closed

#24049Backend modules are complicated to render

Steffen Kamper 11/14/10, 17:55 updated 03/29/11, 23:42

Description

To generate the page of a BE module you have to be carefully and it’s not easy to concatenate it the right way.
Also many modules forget to call in last step the replace of JS and CSS markers.

When a module calls $this->doc->startPage, pageRenderer does a render. After this point you can’t add something to pageRenderer anymore, which can lead to problems.

Solution:
Add a shortcut method “render” which does all these steps automatic and deliver the complete page.
This is the recommended way to render a BE module with docheader:

1) collect all content and fill markers with content and docheader items
2) call $this->doc->moduleBody to replace template with markers
3) call $this->docrender to complete the page

Example:

// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
    // Renders the module page
$this->content = $this->doc->render(
    $GLOBALS['LANG']->getLL('title'),
    $this->content
);

(issue imported from #M16383)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.