Code Monkey home page Code Monkey logo

cmsbundle's Introduction

CMSBundle

abandoned!

Setup

Installation

Step 1: Download the bundle

$ composer require kangourouge/cms-bundle

Step 2: Enable the bundle and install assets

<?php

public function registerBundles()
{
    $bundles = array(
        new KRG\CmsBundle\KRGCmsBundle(),
        new KRG\IntlBundle\KRGIntlBundle(),
        new KRG\DoctrineExtensionBundle\KRGDoctrineExtensionBundle(),
        new KRG\EasyAdminExtensionBundle\KRGEasyAdminExtensionBundle(),
    );
}
$ bin/console assets:install

Step 3: Extend entities

  • class Seo extends \KRG\CmsBundle\Entity\Seo;
  • class Page extends \KRG\CmsBundle\Entity\Page;
  • class Menu extends \KRG\CmsBundle\Entity\Menu;
  • class Block extends \KRG\CmsBundle\Entity\Block;
  • class Filter extends \KRG\CmsBundle\Entity\Filter;

Step 4: Configuration

# app/config/config.yml

framework:
    serializer: { enable_annotations: true }
    router:
        type: 'krg.routing.loader'
        
doctrine:
    orm:
        mappings:
            translatable:
                type: annotation
                alias: Gedmo
                prefix: Gedmo\Translatable\Entity
                dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
            loggable:
                type: annotation
                prefix: Gedmo\Loggable\Entity
                dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                is_bundle: false
        resolve_target_entities:
            KRG\CmsBundle\Entity\SeoInterface: AppBundle\Entity\Seo
            KRG\CmsBundle\Entity\PageInterface: AppBundle\Entity\Page
            KRG\CmsBundle\Entity\MenuInterface: AppBundle\Entity\Menu
            KRG\CmsBundle\Entity\BlockInterface: AppBundle\Entity\Block
            KRG\CmsBundle\Entity\FilterInterface: AppBundle\Entity\Filter
# app/config/routing.yml

krg_user:
    resource: "@KRGUserBundle/Controller/"
    type:     annotation
    prefix:   /

krg_easyadmin_bundle:
    resource: "@KRGEasyAdminExtensionBundle/Controller/"
    type:     annotation
    prefix:   /admin

krg_doctrine_bundle:
    resource: "@KRGDoctrineExtensionBundle/Controller/"
    type:     annotation

krg_cms:
    resource: "@KRGCmsBundle/Controller/"
    type:     annotation
# app/config/admin.yml

imports:
    - { resource: '@KRGEasyAdminExtensionBundle/Resources/config/easyadmin.yml' }
    - { resource: '@KRGDoctrineExtensionBundle/Resources/config/easyadmin.yml' }    
    - { resource: '@KRGCmsBundle/Resources/config/easyadmin.yml.yml' }
    
easy_admin:
    design:
        css:
            - '/bundles/krgcms/easyadmin/style.css'
            - '/bundles/krgeasyadminextension/css/style.css'

Usage

Twig functions

Title & metas: seo_head()

<html>
<head>
    ...
    {{ seo_head() }}
    ...
</head>

Page link: seo_url()

{{ seo_url('cgu') }}

Blocks: krg_block()

{{ krg_block('example') }}

Blocks usage

Filters

In order to be able to create a custom form, you need to tag your form like this:

  • handler (optional): usefull if you have special form processing. Extends KRG\CmsBundle\Form\Handler\AbstractFormHandler
  • template (optional): twig rendered file
  • alias (optional): displayed name in admin
services:
    AppBundle\Form\ExampleType:
        tags:
            - { name: 'krg.cms.form', handler: 'AppBundle\Form\Handler\TestHandler', template: '@App/Form/test.html.twig', alias: 'Form test' }

Files

# app/config/config.yml

krg_cms:
    blocks_path:
        - '%kernel.project_dir%/app/config/cms/blocks/'
        - '%kernel.project_dir%/app/config/cms/h2.yml'
h2:
    label: Title H2
    template: 'blocks/h2.html.twig'
    thumbnail: '/blocks/thumb_h2.png'

h2.html.twig

<h2>Title</h2>

To be able to edit an invisible area from the admin, add class "cms-hidden-area" and the data attribute "data-parent-label" to your block source.

<div class="cms-hidden-area" data-parent-label="Action button">
</div> 

Override

MenuBuilder

services:
    KRG\CmsBundle\Menu\MenuBuilderInterface: '@AppBundle\Menu\MenuBuilder'

cmsbundle's People

Contributors

arthur-min avatar chafiq avatar t00m4s avatar atomatis avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.