承接 brickrouge/css-class-names 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

brickrouge/css-class-names

Composer 安装命令:

composer require brickrouge/css-class-names

包简介

An API to support CSS class names.

README 文档

README

An API to support CSS class names.

Helper

<?php

namespace Brickrouge;

$class_names = [

	'node-id' => 'node-id-13',
	'node-slug' => 'node-slug-example',
	'is-active' => true,
	'is-disabled' => false

];

render_css_class($class_names)
// "node-id-13 node-slug-example is-active"
render_css_class($class_names, [ 'node-id', 'is-active', 'is-disabled' ]);
// "node-id-13 is-active"
render_css_class($class_names, 'node-id is-active is-disabled');
// "node-id-13 is-active"
render_css_class($class_names, [ '-node-id', '-node-slug' ]);
// "is-active"
render_css_class($class_names, '-node-id -node-slug');
// "is-active"

CSSClassNames and CSSClassNamesProperty

Classes that implements the CSSClassNames interface might want to use the CSSClassNamesProperty trait that provides support for the css_class and css_class_names magic properties.

<?php

namespace Icybee\Modules\Nodes;

use Brickrouge\CSSClassNames;
use Brickrouge\CSSClassNamesProperty;

// …

class Node extends ActiveRecord implements CSSClassNames
{
	use CSSClassNamesProperty;

	// …

	/**
	 * Returns the CSS class names of the node.
	 *
	 * @return array[string]mixed
	 */
	protected function get_css_class_names()
	{
		$nid = $this->nid;
		$slug = $this->slug;

		return [

			'type' => 'node',
			'id' => $nid ? "node-{$nid}" : null,
			'slug' => $slug ? "node-slug-{$slug}" : null,
			'constructor' => 'constructor-' . \ICanBoogie\normalize($this->constructor)

		];
	}
}

An instance of such a Node class could be used as follows:

<?php

// …

$node->css_class;
// node node-123 node-slug-example constructor-nodes
$node->css_class_names;
// [ 'type' => node, 'id' => 'node-123', 'slug' => 'node-slug-example', 'constructor' => 'constructor-nodes' ]
$node->css_class('-slug -constructor');
// node node-123
$node->css_class('id slug');
// node-123 node-slug-example

Requirement

The package requires PHP 5.4 or later.

Installation

The recommended way to install this package is through Composer. Create a composer.json file and run php composer.phar install command to install it:

{
	"minimum-stability": "dev",
	"require":
	{
		"brickrouge/css-class-names": "*"
	}
}

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone git://github.com/Brickrouge/CSSClassNames.git

Documentation

The documentation for the package and its dependencies can be generated with the make doc command. The documentation is generated in the docs directory using ApiGen. The package directory can later by cleaned with the make clean command.

Testing

The test suite is ran with the make test command. Composer is automatically installed as well as all the dependencies required to run the suite. The package directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status

License

Brickrouge/CSSClassNames is licensed under the New BSD License - See the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固