Skip to content

castlecms/plone.app.blocks

Repository files navigation

Introduction to Blocks

This is a fork of the standard plone.app.blocks package for Castle CMS. The main difference in this package is the way tiles are rendered on a page to improve eliability and speed.

This fork also removes things that are unnecessary transforms:

  • plone.app.blocks.mergepanels
  • plone.app.blocks.esirender

This package is released to a private repository.

The rest of the docs are exactly the same as the original...

Travis CI badge Coveralls badge Downloads

This package implements the 'blocks' rendering model, by providing several transform stages that hook into plone.transformchain.

The rendering stages are:

plone.app.blocks.parsexml (order 8000)
Turns the response in a repoze.xmliter XMLSerializer object. This is then used by the subsequent stages. If the input is not HTML, the transformation is aborted.
plone.app.blocks.tiles (order 8500)
Resolve tiles and place them directly into the merged layout. This is the fallback for views that do not opt into ITilePageRendered.
plone.app.blocks.gridsystem (order 8700)
Apply responsive classes to the grid system. The grid system setting is on the html tag attribute "data-gridsystem". It defaults to "deco" which is the plone 4 sunburst theme grid system. plone.app.blocks also supports the value of "bs3" which is bootstrap 3 grid system. To change the grid system used, change the IBlocksSettings.default_grid_system value in the Configuration Registry. If you're only using content tile transforms, you'll need to set a default grid system that matches your theme.

Site layouts

The package also registers the sitelayout plone.resource resource type, allowing site layouts to be created easily as static HTML files served from resource directories. The URL to a site layout is typically something like:

/++sitelayout++my.layout/site.html

See plone.resource for more information about how to register resource directories. For site layouts, the type of the resource directory is sitelayout.

It is possible to provide a manifest file that gives a title, description and alternative default file for a site layout HTML file in a resource directory. To create such a manifest, put a manifest.cfg file in the layout directory with the following structure:

[sitelayout]
title = My layout title
description = Some description
file = some-html-file.html

All keys are optional. The file defaults to site.html. Single manifest may contain multiple [sitelayout] sections.

A vocabulary factory called plone.availableSiteLayouts is registered to allow lookup of all registered site layouts. The terms in this vocabulary use the URL as a value, the resource directory name as a token, and the title from the manifest (falling back on a sanitised version of the resource directory name) as the title.

The current default site layout can be identified by the plone.registry key plone.defaultSiteLayout, which is set to None by default. To always use the current site default, use:

<html data-layout="./@@default-site-layout">

The @@default-site-layout view will render the current default site layout.

Content layouts

The package also registers the contentlayout plone.resource resource type, allowing shared content area layouts to be created easily as static HTML files served from resource directories. The URL to a site layout is typically something like:

/++contentlayout++my.layout/content.html

See plone.resource for more information about how to register resource directories. For site layouts, the type of the resource directory is contentlayout.

It is possible to provide a manifest file that gives a title, description and alternative default file for a site layout HTML file in a resource directory. To create such a manifest, put a manifest.cfg file in the layout directory with the following structure:

[contentlayout]
title = My layout title
description = Some description
file = some-html-file.html
screenshot = mylayout.png
for = Document,Folder

All keys are optional. The file defaults to content.html. Single manifest may contain multiple [contentlayout] sections.

A vocabulary factory called plone.availableContentLayouts is registered to allow lookup of all registered content layouts. The terms in this vocabulary use the URL as a value, the resource directory name as a token, and the title from the manifest (falling back on a sanitised version of the resource directory name) as the title.

The default content layout can be identified by the plone.registry key plone.app.blocks.default_layout and default content layout for some specific content type with key plone.app.blocks.default_layout.my_type. The default content layout is supported by the built-in layout_view browser view for content with ILayoutAware behavior.

ILayoutAware behavior

It is possible for the default site layout to be overridden per section, by having parent objects provide or be adaptable to plone.app.blocks.layoutbehavior.ILayoutAware. As the module name implies, this interface can be used as a plone.behavior behavior, but it can also be implemented directly or used as a standard adapter.

The ILayoutAware interface defines three properties:

  • content, which contains the body of the page to be rendered
  • contentLayout, which contains the path to the selected static content layout, which is used instead of content when set.
  • pageSiteLayout, which contains the path to the site layout to be used for the given page. It can be None if the default is to be used.
  • sectionSiteLayout, which contains the path to the site layout to be used for pages underneath the given page (but not for the page itself). Again, it can be None if the default is to be used.

To make use of the page site layout, use the following:

<html data-layout="./@@default-site-layout">

See rendering.rst for detailed examples of how the processing is applied, and esi.rst for details about how Edge Side Includes can be supported.

About

No description, website, or topics provided.

Resources

License

Unknown, GPL-2.0 licenses found

Licenses found

Unknown
LICENSE.txt
GPL-2.0
LICENSE.GPL

Stars

Watchers

Forks

Packages

No packages published