2017 © Pedro PelĆ”ez
 

phile-plugin twig-filters

An example plugin for Phile showing how to make Twig filters.

image

phile/twig-filters

An example plugin for Phile showing how to make Twig filters.

  • Thursday, March 29, 2018
  • by NeoBlack
  • Repository
  • 2 Watchers
  • 0 Stars
  • 60 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Twig Functions

Build Status, (*1)

Adds helpfull Twig functions to Phile and easily allows you to create new ones. Project home., (*2)

Installation

composer require phile/twig-functions

Activation

$config['plugins']['phile\\twigFunctions'] = [
    'active' => true
];

Usage

This plugin includes some predefined Twig-filter and allows you to easily add your own., (*3)

Define a New Custom Filter

See the existing filters in config.php for how to add your own filter., (*4)

excerpt

Grabs the first paragraph of the content string., (*5)

{{ content|excerpt }}

limit_words

Similar to excert but limits on number of words. Use Twig's striptags to remove HTML-tags., (*6)

{{ page.content|striptags|limit_words }}

shuffle

Shuffles an array. For example show a shuffled lists of pages:, (*7)

<ul class="posts">
  {% for page in pages|shuffle %}
    <li><a href="{{ page.url }}">{{ page.title }}</a></li>
  {% endfor %}
</ul>

slugify

This new Twig filter allows you to slugify a string. This is useful for making safe URLs, HTML-safe class/id names, or just cleaning up general strings., (*8)

<!-- becomes "thisā€“isā€“anā€“strangeā€“string" -->
{{ "This Is ____an STRƄNGE      string" | slugify }}

The Versions

29/03 2018

dev-master

9999999-dev http://philecms.com

An example plugin for Phile showing how to make Twig filters.

  Sources   Download

MIT

The Requires

 

The Development Requires

twig cms content phile

29/03 2018

1.1.0

1.1.0.0 http://philecms.com

An example plugin for Phile showing how to make Twig filters.

  Sources   Download

MIT

The Requires

 

The Development Requires

twig phile

06/05 2015

1.0.1

1.0.1.0 http://philecms.com

An example plugin for Phile showing how to make Twig filters.

  Sources   Download

MIT

The Requires

 

cms content phile