hypejunction/elgg-snippets
Composer 安装命令:
composer require hypejunction/elgg-snippets
包简介
Editable HTML snippets for use in themes and views
关键字:
README 文档
README
Reusable and editable snippets with variable interpolation
Features
Using plugin settings to alter large chunks of HTML is repetitive and not very efficient: you have to update plugins settings, remember in which plugin a setting lives, figure out how to populate default values, implement weird mechanics to interpolate variables etc.
This plugin makes it easy, just create a snippets in your views and will be available
for editing via admin interface. Snippets can then be injected into your views with
elgg_snippet().
Usage
Once the plugin is enabled, snippets can be edited under Admin > Appearance > HTML Snippets.
Create a default snippet as a .twig view anywhere in views/default/snippets/:
// my-plugin/views/default/snippets/page/footer.twig <div class="footer"> <a class="{{ normalizeUrl('/contact') }}">Contact Us</a> </div>
Render a snippet where it belongs:
// my-plugin/views/default/somewhere.php echo elgg_snippet('page/footer');
You can provide the title and the description of the snippet using translations:
// languages/en.php return [ 'snippet:page/footer' => 'Page Footer Template', 'snippet:page/footer:help' => 'Displayed on all pages in the footer area', ];
Storage
Snippet overrides are stored in the dataroot, so be sure to copy them over if migrating your site. You can also reset to default template, by deleting a corresponding snippet from the dataroot.
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2019-02-14