Skip to content

Commit

Permalink
ENH Add extension points to update element controller styles and temp…
Browse files Browse the repository at this point in the history
…late
  • Loading branch information
michalkleiner authored Oct 19, 2021
1 parent de38165 commit d94cadc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Controllers/ElementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,20 @@ public function getElement()
public function forTemplate()
{
$defaultStyles = $this->config()->get('default_styles');
$this->extend('updateForTemplateDefaultStyles', $defaultStyles);

if ($this->config()->get('include_default_styles') && !empty($defaultStyles)) {
foreach ($defaultStyles as $stylePath) {
Requirements::css($stylePath);
}
}

$template = $this->element->config()->get('controller_template');
$template = 'DNADesign\\Elemental\\' . $this->element->config()->get('controller_template');
$this->extend('updateForTemplateTemplate', $template);

return $this->renderWith([
'type' => 'Layout',
'DNADesign\\Elemental\\'.$template
$template
]);
}

Expand Down

0 comments on commit d94cadc

Please sign in to comment.