The Categories Viewtool provides methods to pull category information and related categories.
Methods
Method | Return Value | Description |
---|---|---|
init(Object obj) | None | Ititalizes the Category object. |
getChildrenCategoriesByKey(String key) | List | Returns child categories for the key you passed in. |
getCategoryByKey(String key) | Category | Gives you the category for the ID that you passed in. |
getCategoryByName(String name) | Category | Gives you the category for the String name that you passed in. |
getChildrenCategories(Category cat) | List | Returns a list of the children categories of the category passed in. |
getChildrenCategories(Inode inode) | List | Returns a list of the categories that are the children of the category associated with the inode passed in. |
getChildrenCategories(String string) | List | Returns a list of the child categories of the category associated with the string passed in. |
getChildrenCategories(String inode, boolean includeGrandChildren, int maxDepth) | List | Returns a list of the child categories (and grand children depending on the boolean passed in) of the category associated with the string passed in up to the depth passed in. |
getChildrenCategories(Category parentCategory, int level, int maxDepth) | List | Returns a list of the child categories of the category including the children of the origional categories children up to the depth passed in. |
getActiveChildrenCategories(Category cat) | List | Returns a list of the active child categories for the parent category passed in. |
getActiveChildrenCategoriesByKey(String key) | List | Returns a list of the active child categories for the category associated with the key passed in. |
getActiveChildrenCategories(Inode inode) | List | Returns a list of the active child categories of the category associated with the inode passed in. |
getActiveChildrenCategories(String inode) | List | Returns a list of the active child categories for the parent category associated with the string passed in. |
getActiveChildrenCategoriesOrderByName(Category cat) | List | Returns a list of the active child categories in order by name for the parent category passed in. |
getActiveChildrenCategoriesOrderByName(Inode inode) | List | Returns a list of the active child categories in order by name for the parent category associated with the inode passed in. |
getActiveChildrenCategoriesOrderByName(String inode) | List | Returns a list of the active child categories in order by name for the parent category associated with the string passed in. |
getActiveChildrenCategoriesByParent(ArrayList<String> o) | List | Returns a list of the active child categories of each of the parent categories associated with the strings passed in. |
The following example shows how the CategoriesWebAPI Viewtool is mapped in the toolbox.xml file:
<tool>
<key>categories</key>
<scope>request</scope>
<class>com.dotcms.rendering.velocity.viewtools.CategoriesWebAPI</class>
</tool>