Back to FileLayout class

Method sublayout

public string
sublayout
(mixed $layoutId, mixed $displayData)
Render a layout with the same include paths & options
Parameters
  • string $layoutId The identifier for the sublayout to be searched in a subfolder with the name of the current layout
  • mixed $displayData Data to be rendered
Returns
  • string The necessary HTML to display the layout
Since
  • 3.2
Class: FileLayout
Project: Joomla

Method sublayout - Source code

/**
 * Render a layout with the same include paths & options
 *
 * @param   string  $layoutId     The identifier for the sublayout to be searched in a subfolder with the name of the current layout
 * @param   mixed   $displayData  Data to be rendered
 *
 * @return  string  The necessary HTML to display the layout
 *
 * @since   3.2
 */
public function sublayout($layoutId, $displayData)
{
    // Sublayouts are searched in a subfolder with the name of the current layout
    if (!empty($this->layoutId)) {
        $layoutId = $this->layoutId . '.' . $layoutId;
    }
    $sublayout = new static($layoutId, $this->basePath, $this->options);
    $sublayout->includePaths = $this->includePaths;
    return $sublayout->render($displayData);
}