dev-master
9999999-dev http://github.com/ornj/twig-bundleProvides helpful Twig extensions for Symfony2
MIT
The Requires
- php >=5.3.0
- symfony/twig-bundle ~2.1
twig extension
Provides helpful Twig extensions for Symfony2
This bundle contains helpful Twig extensions for the Symfony2 framework. These extensions provide simple, front end functionality that is often times present on web pages., (*1)
Install this bundle in your Symfony2 project by adding it to your composer.json
., (*2)
{ "require": { "ornj/twig-extensions-bundle": "dev-master" } }
After running updating composer, register the bundle in app/AppKernel.php
., (*3)
$bundles = array( // ... new Ornj\Bundle\TwigExtensionsBundle\OrnjTwigExtensionsBundle(), );
Determines if the url points to a host external to the current site., (*4)
host
: Provide the host you want to check against. You can get the current host by passing app.request.httpHost
.{{ 'http://www.example.com' | is_external(app.request.httpHost) }}
Generates a url for sharing the current page on Facebook. Accepts the following parameters:, (*5)
picture
: path to an imagename
: the post titlecaption
: caption to show next to the imagedescription
: content of the postredirect
: where to send the user after they share the post {{ url('route', { id: entity.id }) | facebook_share('http://example.com/images/img.jpg', 'name', 'caption', 'description', 'example.com/redirect) }}
In addition to the above parameters you must also provide a Facebook application id. Currently the parameter facebook_app_id
is being used. You can set the parameter however you'd like. One location this could be defined is in app/config/parameters.yml
., (*6)
Generates a url for sharing the current page on Pinterest. Accepts the following parameters:, (*7)
media
: path to the media being pinneddescription
: content of the post{{ url('route', { id: entity.id }) | pinterest_share('http://example.com/images/img.jpg', 'description') }}
Generates a url for sharing the current page on Twitter. Accepts a message to input into the tweet., (*8)
message
: Body of the tweet{{ url('route', { id: entity.id }) | twitter_share('Check out this page!') }}
Provides helpful Twig extensions for Symfony2
MIT
twig extension