cnp/wp-atom-builder
Composer 安装命令:
composer require cnp/wp-atom-builder
包简介
Build filterable atomic elements.
README 文档
README
##Atom Builder
The Atom class builds atomic markup from PHP arguments. For example, if you wanted this output:
<h2 class="section-title">A Section Title</h2>
You could use this PHP code to render it:
$section_title_args = [ 'tag' => 'h2', 'content' => 'A Section Title' ]; $section_title = CNP\Atom::Assemble('section-title', $section_title_args); echo $section_title;
Sure, this is slightly longer, but here's what is included in the Atom class:
###Filters
All the filters in the Atom class are namespaced to the name of the atom. An atom named 'section-title' would have an arguments filter named 'section-title_args'.
$atom_name_args: filter the arguments array.$atom_name_classes: filter the classes array.$atom_name_id: filter the ID.$atom_name``$attribute_name_value: filter a specific attribute's value.$atom_name_attributes: filter the completed attributes array.$atom_name_content: filter the atom content.$atom_name_markup: filter the compiled markup.
Filtering the markup means that we can dynamically change the atom output on different areas of a site, without needing to change the atom arguments.
This also allows us to create generic blueprints that we can reuse from site-to-site, either adjusting arguments or filtering the atom where necessary.
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-29