定制 dotblue/nette-control-rendering 二次开发

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

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

dotblue/nette-control-rendering

Composer 安装命令:

composer require dotblue/nette-control-rendering

包简介

Multiple rendering modes for Control hierarchical structure with AJAX support.

README 文档

README

Requirements

Installation

Just copy source codes from Github or using Composer:

$ composer require dotblue/nette-control-rendering@~1.0

Usage

If you want your custom component to support mode than default rendering mode, you can achieve that by writing more rendermethods, like this:

public function render()
{
    ...
}

public function renderSmall()
{
    ...
}

In template, you can use the second rendering mode with colon notation:

{control foo:small}

But this approach doesn't work well with AJAX. Also, sometimes your component consists of many subcomponents, but the whole hierarchical structure should have the same unified set of rendering modes. Imagine for example some data structure, which can be rendered as complex HTML or just a table, and you wish to implement each cell as component as well. Then not only the main component must have 2 rendering modes, but the cell subcomponents too.

That's what DotBlue\NetteControl\Renderer class is for. Just wrap your component in its factory method, and set proper rendering mode:

use DotBlue\NetteControl\Renderer;

protected function createComponentFoo()
{
    return new Renderer(new Foo, 'small');
}

Now even if you use simple {control foo} in template, the renderSmall() method will be called for rendering. Including AJAX requests!

But that's not all. All subcomponents of your Foo component will get wrapped by the same Renderer automatically too. So if they implement method renderSmall() as well, it will be used, and you don't need to specify that in template anywhere.

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 6
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-04-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固