Skip to content

Commit

Permalink
Add template and view arguments support to IBodyClassAdapters
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Oct 13, 2018
1 parent e08fae8 commit 6d25294
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ New features:

Bug fixes:

- *add item here*
- Add template and view arguments support to IBodyClassAdapters (fixes `#158 <https://github.com/plone/plone.app.layout/issues/158>`_).
[rodfersou]


2.5.23 (2017-01-17)
Expand Down
5 changes: 4 additions & 1 deletion plone/app/layout/globals/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ def bodyClass(self, template, view):
IBodyClassAdapter
)
for name, body_class_adapter in body_class_adapters:
extra_classes = body_class_adapter.get_classes() or []
try:
extra_classes = body_class_adapter.get_classes(template, view) or []
except TypeError: # This adapter is implemented without arguments
extra_classes = body_class_adapter.get_classes() or []
if isinstance(extra_classes, basestring):
extra_classes = extra_classes.split(' ')
body_classes.extend(extra_classes)
Expand Down

0 comments on commit 6d25294

Please sign in to comment.