33. Using Third-Party Behaviors

33.1. Add Teaser With collective.behavior.banner

There are a lot of add-ons in Plone for sliders/banners/teasers. We thought there should be a better one and created collective.behavior.banner.

../_images/standards.png

To use it add the name to your list of eggs in buildout.cfg:

eggs =
    Plone
    ...
    collective.behavior.banner

Even though collective.behavior.banner has been released on pypi we’ll now will act as if this addon exists on github only - or alternatively has changes on github that have not been released yet but you that you really want. This is not to annoy you - it happens surprisingly often if you work with new versions of Plone.

The training buildout has a section [sources] that tells buildout to download a specific add-on not from PyPI but from some code repository (usually GitHub):

[sources]
collective.behavior.banner = git https://github.com/collective/collective.behavior.banner.git pushurl=git@github.com:collective/collective.behavior.banner.git rev=7c13285

Pinning the revision saves us from being surprised by changes in the code we might not want. You can also pinn a branch or a tag.

After adding the source, we need to add the egg to list of eggs that should be checked out:

# We want to checkout these eggs directly from github
auto-checkout =
    ploneconf.site
    collective.behavior.banner

And rerun ./bin/buildout

  • Install the add-on
  • Create a new dexterity content type Banner with only the behavior Banner enabled.
  • Create a folder called banners
  • Add two banners into that folder using images taken from https://placekitten.com or http://lorempixel.com
  • Add the Behavior Slider to the default content type Page (Document)
  • Edit the front-page and link to the new banners.