Twohill\NestedControllers\NestedModelController
NestedModelController allows the control of objects that are related to one another via sub-urls
Synopsis
class NestedModelController
extends Controller
{
- // members
- protected $parentController;
- protected $currentRecord;
- protected $recordType;
- public static string $breadcrumbs_delimiter = " » ";
- protected array $crumbs = ;
- public $Title;
- private static array $allowed_actions = ;
- private static array $url_handlers = ;
- // methods
- public void __construct()
- public void __get()
- public void __call()
- public string Link()
- public DataObject getRecord()
- public void index()
- public void view()
- public void edit()
- public void delete()
- public void getViewer()
- public Form Form()
- public void doSave()
- public void doCancel()
- public void httpError()
- public void addCrumb()
- public array Breadcrumbs()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $allowed_actions
- $url_handlers
protected
- $crumbs
- $currentRecord
- $parentController
- $recordType
public
- $Title
Methods
public
- __construct() — The model controller needs to be passed the required info:
- Breadcrumbs() — Build on the breadcrumbs to show the nested actions
- Form() — Scaffolds the fields required for editing the record
- Link() — Link fragment - appends the current record ID to the URL.
- __call()
- __get() — Overloading __get() and __call() to support nested controllers, e.g. so we can still get the main site menu Also allows RecordType() to return the currentRecord
- addCrumb() — Adds a breadcrumb action
- delete()
- doCancel() — Cancels editing and returns to the view of the record
- doSave() — Save the record
- edit() — Returns a form for editing the record
- getRecord() — Returns the record we're working with
- getViewer() — If a parentcontroller exists, use its main template, and mix in specific collectioncontroller subtemplates.
- httpError() — Show a pretty error, if possible
- index() — Returns the view of the record
- view() — Returns the view of the record