DNADesign\Elemental\Controllers\ElementController
Optional controller for every element which has its own logic, e.g. in forms.
It always handles a single element, usually passed in as a database
identifier through the controller URL. Needs to be constructed as a nested
controller within a .
## Forms
You can add forms like in any other SilverStripe controller. If you need
access to the element from within a form, you can use
`$this->controller->getElement()` inside the form logic.
Synopsis
class ElementController
extends Controller
{
- // members
- protected BaseElement $element;
- private static array $default_styles = ;
- private static bool $include_default_styles = true;
- // methods
- public void __construct()
- public BaseElement getElement()
- public string forTemplate()
- public string Link()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $default_styles
—
array
A list of default (example) styles to include - $include_default_styles
—
DNADesign\Elemental\Controllers\bool
Whether to include default (example) styles
protected
- $element — DNADesign\Elemental\Models\BaseElement
Methods
public
- __construct()
- Link()
- forTemplate() — Renders the managed {@link BaseElement} wrapped with the current {@link ElementController}.
- getElement()