定制 twohill/silverstripe-nestedcontrollers 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

twohill/silverstripe-nestedcontrollers

Composer 安装命令:

composer require twohill/silverstripe-nestedcontrollers

包简介

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

README 文档

README

NESTED CONTROLLERS SNIPPET FOR SILVERSTRIPE

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).

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

eg: /mypage/people/12/edit /mypage/people/12/favourite-people

It allows deep traversal through related objects:

eg: /mypage/people/12/mother/uncles/43/edit

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.

How to use

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

<?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.

Obviously you need a PeopleCollectionController so lets have a look at what it might look like.

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

统计信息

  • 总下载量: 467
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固