Rev | Line | |
---|
[319] | 1 | ## Script (Python) "getCreatableItems" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | items = [] |
---|
| 11 | utool = context.portal_url |
---|
| 12 | base_url = utool.getBaseUrl() |
---|
| 13 | #return context.getPortalTypeName() |
---|
| 14 | |
---|
| 15 | if context.getPortalTypeName() == 'Portal': |
---|
| 16 | return items |
---|
| 17 | |
---|
| 18 | content_types = context.getSortedContentTypes(allowed=1) |
---|
| 19 | renderIcon = context.portal_cpsportlets.renderIcon |
---|
| 20 | |
---|
| 21 | for ptype in content_types: |
---|
| 22 | ptype_id = ptype.getId() |
---|
| 23 | items.append({ |
---|
| 24 | 'title': ptype.Title(), |
---|
| 25 | 'id': ptype_id, |
---|
| 26 | 'icon_tag': renderIcon(ptype_id, base_url, '') |
---|
| 27 | }) |
---|
| 28 | |
---|
| 29 | return items |
---|
Note: See
TracBrowser for help on using the repository browser.