/   /   /  OroCommerce Some lines about layout (Block , Container , CMS Page) ….

Note:

For more extensions and themes visit our store

OroCommerce Some lines about layout (Block , Container , CMS Page) ….


Inside views folder you will find folder layouts contain 2 floders of theme for example if you go to vendor/oro/commerce/src/Oro/Bundle/CMSBundle/Resources/views/layouts , you will find 2 themes blank and default as basic theme .
Inside everyone of it we have folders which named by (oro_frontend_root = home page or global declaration) (oro_cms_frontend_page_view = cms page view ) .
inisde this last folders you have your layouts yml with .twig is the renderer of .yml layout . Ok let's open vendor/oro/commerce/src/Oro/Bundle/CMSBundle/Resources/views/layouts/default/oro_frontend_root/home_page_slider.yml the content is : 

  1.  
  2. layout:
  3.     actions:
  4.         - '@setBlockTheme':
  5.             themes: 'default.html.twig'
  6.         - '@addTree':
  7.             items:
  8.                 hero_promo_container:
  9.                     blockType: container
  10.                     prepend: true
  11.                 hero_promo:
  12.                     blockType: content_block
  13.                     options:
  14.                         alias: home-page-slider
  15.             tree:
  16.                 page_content:
  17.                     hero_promo_container:
  18.                         hero_promo: ~
  19.  
  20.  

By word actions you start push your content , here we have two actions : @setBlockTheme for set the .twig renderer of this layout  default.html.twig . And the @addTree of container and content block . The container : 

  1.  
  2.                 hero_promo_container:
  3.                     blockType: container
  4.                     prepend: true
  5.  
  6.  

and the block :
  1.  
  2.                     blockType: content_block
  3.                     options:
  4.                         alias: home-page-slider
  5.  
  6.  

alias here is the name of cms page , is already created from admin with this code .
In last you have the structure of tree :
  1.  
  2.                 page_content:
  3.                     hero_promo_container:
  4.                         hero_promo: ~
  5.  
  6.  

contentBlock.content : will use the alias home-page-slider the get block instance and display content 
oro_html_tag_trim(['script','style', 'link']) : you have allowed script style and link tag (execution and rendering)

The **OroLayoutBundle** introduces a set of block types that allow to easily build HTML layout structure.

| Type name | Default HTML output |
|-----------|-------------|
| `root` | `<html>` |
| `head` | `<head>` |
| `title` | `<title>` |
| `meta` | `<meta>` |
| `style` | `<style>` with content or `<link>` with external resource |
| `script` | `<script>` |
| `external_resource` | `<link>` |
| `body` | `<body>` |
| `form_start` | `<form>` |
| `form_end` | `</form>` |
| `form` | Creates three child block: `form_start`, `form_fields`, `form_end` |
| `form_fields` | Adds form fields based on the Symfony form |
| `form_field` |  Block will be rendered differently depending on the field type of the Symfony form |
| `fieldset` | `<fieldset>` |
| `link` | `<a>` |
| `list` | `<ul>` |
| `ordered_list` | `<ol>` |
| `list_item` | `<li>`, this block type can be used if you want to control rendering of `li` tag and its attributes |
| `text` | Text node |
| `input` | Input node |
| `button` | `<button>` or `<input type="submit/reset/button">` |
| `button_group` | Nothing, this is just a logical grouping of buttons. You can define how to render the button group in your application |

Comments

IBNAB is a company made of a group of professionals whose work is providing secure open source solutions. Our company strives for reaching magnificent results with each experience and provides professional open source solutions that cover every part of the business process.

Newsletter