Twohill\NestedControllers\NestedCollectionController
NestedModelController allows the control of objects that are related to one another via sub-urls
Based off SilverStripe's Generic Views Module
http://www.silverstripe.org/generic-views-module/
By Ingo Schommer
Synopsis
class NestedCollectionController
extends Controller
{
- // members
- private static $recordController = NestedModelController::class;
- private static $recordType = DataObject::class;
- private static integer $results_per_page = 20;
- private static string $sort_on = "Name";
- private static string $breadcrumbs_delimiter = " » ";
- protected array $crumbs = ;
- protected $parentController;
- protected $urlSegment;
- protected $request;
- public $Title;
- private static array $url_handlers = ;
- private static array $allowed_actions = ;
- // methods
- public DBHTMLText handleActionOrID()
- public void __construct()
- public mixed __get()
- public void __call()
- public string Link()
- public PaginatedList getAllRecords()
- public PaginatedList getEditableRecords()
- public void getRecordType()
- public string getSingularName()
- public string getPluralName()
- public void index()
- public void canCreate()
- public ViewableData_Customised|void create_new()
- public SSViewer getViewer()
- public Form CreationForm()
- public void doSave()
- public void doCancel()
- public void httpError()
- public void addCrumb()
- public array Breadcrumbs()
- public ArrayList AlphabetPages()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $allowed_actions
- $recordController
- $recordType
- $results_per_page
- $sort_on
- $url_handlers
protected
- $crumbs
- $parentController
- $request
- $urlSegment
public
- $Title
Methods
public
- __construct() — The collection controller needs to be passed a parent controller, usually this is a page
- AlphabetPages() — Generates a ArrayList of anonymous objects that can be used to create an alphabet menu for all the items, linking only when there are items begining with the letter, and providing an indication of whether it is currently selected or not
- Breadcrumbs() — Extends breadcrumbs to provide links down the nested chain
- CreationForm() — Scaffolds a form for creating managed data types
- Link() — Returns a link to this controller
- __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() — Maintains breadcrumbs down the nested chain
- canCreate() — Checks if the current member can create a new record
- create_new() — URL method to create a new record
- doCancel() — URL function for cancelling creating/editing an object
- doSave() — Function for saving the form
- getAllRecords() — Gets all the records and returns them, paginated
- getEditableRecords() — Gets all editable records and returns them, paginated
- getPluralName() — Gets the plural name of the type of record the controller works with
- getRecordType() — Subclasses should specify the types of records they work with
- getSingularName() — Gets the singular name of the type of record the controller works with
- getViewer() — If a parentcontroller exists, use its main template, and mix in specific collectioncontroller subtemplates.
- handleActionOrID() — Delegate to different control flow, depending on whether the URL parameter is a number (record id) or string (action).
- httpError() — Return a nice error, if possible
- index() — Uses the default template to show an index of all the records