Download the PHP package vladislavs/content-bundle without Composer
On this page you can find all versions of the php package vladislavs/content-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vladislavs/content-bundle
More information about vladislavs/content-bundle
Files in vladislavs/content-bundle
Package content-bundle
Short Description This bundle provides localized content management
License MIT
Homepage http://github.com/arcanacode/content-bundle
Informations about the package content-bundle
README
License here.
What is Arcana Content Bundle?
Arcana Content Bundle allows administrators to edit texts directly in the page, not some separate Admin section.
Requirements
- Symfony 2.4.x
- See also the
require
section of composer.json
Installation
Bundle can be installed via Composer. You can find this bundle on packagist: https://packagist.org/packages/arcanacode/content-bundle
// composer.json
{
// ...
require: {
// ..
"arcanacode/content-bundle": "dev-master"
}
}
Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:
php composer.phar update
You have to add this bundle to AppKernel.php
register bundles method, so that Symfony can use it.
// in AppKernel::registerBundles() $bundles = array( // ... new Arcana\Bundle\ContentBundle\ArcanaContentBundle(), );
In your config.yml
you must add this bundle to jms_di_extra.
jms_di_extra: locations: bundles: [ ArcanaContentBundle ]
Next add bundle to the 'app/config/routing.yml' file.
arcana_content: resource: "@ArcanaContentBundle/Controller/" type: annotation
In base template file include stylesheets and javascripts for only users with ROLE_ADMIN
{% if is_granted('ROLE_ADMIN') %} {% stylesheets filter="cssrewrite" "bundles/arcanacontent/vendor/raptor/raptor-custom-front-end.min.css" %} {% endstylesheets %} {% endif %} {% if is_granted('ROLE_ADMIN') %} {% javascripts "bundles/arcanacontent/vendor/raptor/raptor.custom.min.js" "bundles/arcanacontent/js/manager.js" %} {% endjavascripts %} {% endif %}
Put somewhere in your base template
window.arcana_content_manager.contentSaveUrl = '{{ path('arcana_content_save') }}';
In your security.yml file restrict access for arcana_content_save path only to administrators.
access_control: //.. - { path: ^/save, roles: ROLE_ADMIN }
Finally run app/console doctrine:schema:update --force to create 'content' table in your database.
Usage
In order to use the bundle, all texts you want to be able to edit, must be added to template with content filter in such format:
{{ 'default value' | content('name', {options}) }}
'default value' is the default text, that will appear if no content is found in database. 'name' is the name of content in the content table. 'options' - array of options (listed below). Example:
{{ 'Welcome to the Arcana Content Bundle!' | content('default_page_title', { editable_separately: true, type: 'plaintext' }) }}
You can also use large text blocks (also with html tags) without using a default value, for example:
{% content of "facts_text" %} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rhoncus massa et dui tempor facilisis. In a luctus erat. Morbi eget tellus fermentum, pretium arcu sed, congue arcu. {% endcontent %}
Separately editable texts
{{ 'You can edit me separately' | content('separate_title_tag', { editable_separately: true, type: 'plaintext' }) }}
Separately editable texts are texts, that are not visible on the page, for example "title" tag. You can edit them by opening "Separately editable contents" popup.
Options available: 'editable_separately' - if 'true', will be editable in separately editable contents popup 'type': 'plaintext'/'block'/'inline'/'anchor' - NEED DESCRIPTION
Contributing
Pull requests are welcome.
Description here.
Running Symfony2 Tests
Description here.
All versions of content-bundle with dependencies
symfony/framework-bundle Version ~2.4
sensio/framework-extra-bundle Version ~3.0
doctrine/orm Version ~2.2,>=2.2.3
jms/di-extra-bundle Version ~1.4