2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-nestedcontrollers

Base for easily setting up CRUD pages in the front end using nested controllers

image

twohill/silverstripe-nestedcontrollers

Base for easily setting up CRUD pages in the front end using nested controllers

  • Tuesday, March 13, 2018
  • by twohill
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 33 % Grown

The README.md

NESTED CONTROLLERS SNIPPET FOR SILVERSTRIPE, (*1)

About

This isn't really a module, but I've re-used it with many projects now so I figured it deserved to be shared. It enables you to create a logical url structure for actions on records (DataObjects)., (*2)

For example, it can be used for CRUD (Create Read Update Delete), or to step through required processes of creating an object in a logical way, (*3)

eg: /mypage/people/12/edit /mypage/people/12/favourite-people, (*4)

It allows deep traversal through related objects:, (*5)

eg: /mypage/people/12/mother/uncles/43/edit, (*6)

And it allows for easy theme overrides. [Record]_[function].ss templates are chosen ahead of [Record].ss templates. And there are fallback templates to kick you off., (*7)

How to use

As a starting point, you need a page that can call the nested functions. eg, (*8)

<?php
class MyPage extends Page {
    //...
}
class MyPage_Controller extends Page_Controller {
    //..
    public function people($request) {
        return new PeopleCollectionController($this, $request);
    }
}

This means that whenever anyone calls a MyPage/people, the PeopleCollectionController will be used., (*9)

Obviously you need a PeopleCollectionController so lets have a look at what it might look like., (*10)

<?php
class PeopleCollectionCotroller extends NestedCollectionController {
    public function favourite_people() {
        // return something allowing the user to view or modify favourite people
    }
}

The Versions

13/03 2018

dev-master

9999999-dev https://github.com/twohill/silverstripe-nestedcontrollers

Base for easily setting up CRUD pages in the front end using nested controllers

  Sources   Download

BSD-3-Clause

The Requires

 

by Al Twohill

crud silverstripe nested