netzmacht/contao-dev-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

netzmacht/contao-dev-tools

Composer 安装命令:

composer require --dev netzmacht/contao-dev-tools

包简介

This library provides tools to simplify common tasks when developing with Contao.

README 文档

README

Build Status Version License Downloads Contao Community Alliance coding standard

This library provides tools for solving common tasks required when developing for Contao CMS.

Install

You can install this library using Composer.

$ php composer.phar require netzmacht/contao-dev-tools:~1.0

Features

DCA related features

####Toggle icon callback

This library ships with a common toggle state icon callback.

<?php

// dca/tl_custom.php

$GLOBALS['TL_DCA']['tl_custom']['fields']['published']['button_callback'] = 
	Netzmacht\Contao\DevTools\Dca::createToggleIconCallback(
		'tl_custom',	// The database table.
		'published',	// the state column
		false,			// Inverse the state. Set to true for invisible='' columns
		'invisible.gif' // Disabled icon. If not set, icons are transformed from edit.gif to edit_.gif
	)

####Convert models to options

One standard task using Contao models is to transform when to options for select lists or checkbox menus. Dev-Tools simplifies it for you.

  • Convert collections to options arrays.
  • Use callbacks to customize the labels.
  • Group values by a third column/callback value.
<?php 

public function yourOptionsCallback()
{
	$collection = \PageModel::findAll();
	
	// Empty collections by Contao are NULL. The OptionsBuilder handles is correctly.
	return Netzmacht\Contao\DevTools\Dca\Options\OptionsBuilder::fromCollection($collection, 'id', 'name')
		->groupBy('type')
		->getOptions();
}
```php

###Dependency injection

Contao does not provide any help for dependency injection. If you need some dependencies from the 
[dependency container](https://github.com/contao-community-alliance/dependency-container) you can use this Trait:

```php

class YourContentElement extends \ContentElement
{
	use Netzmacht\Contao\DevTools\ServiceContainerTrait;
	
	private $service;
	
	public function __construct($model)
	{
		parent::__construct($model);
		
		$this->service = $this->getService('your-required-service');
	}
}

Requirements

  • PHP 5.4 is required.
  • Contao 3.2 - 3.4 is supported.
  • contao-community-alliance/dependency-container ~1.6 is required.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2014-12-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固