Categories Viewtool

Last Updated: Dec 13, 2024
documentation for the dotCMS Content Management System

The Categories Viewtool provides methods to pull category information and related categories.

Methods

MethodReturn TypeDescription
init(Object obj)NoneItitalizes the Category object.
getChildrenCategoriesByKey(String key)List<Category>Returns child categories for the key you passed in.
getCategoryByKey(String key)CategoryGives you the category for the ID that you passed in.
getCategoryByName(String name)CategoryGives you the category for the String name that you passed in.
getChildrenCategories(Category cat)List<Category>Returns a list of the children categories of the category passed in.
getChildrenCategories(Inode inode)List<Category>Returns a list of the categories that are the children of the category associated with the inode passed in.
getChildrenCategories(String string)List<Category>Returns a list of the child categories of the category associated with the string passed in.
getChildrenCategories(String inode, boolean includeGrandChildren, int maxDepth)List<Category>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<Category>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<Category>Returns a list of the active child categories for the parent category passed in.
getActiveChildrenCategoriesByKey(String key)List<Category>Returns a list of the active child categories for the category associated with the key passed in.
getActiveChildrenCategories(Inode inode)List<Category>Returns a list of the active child categories of the category associated with the inode passed in.
getActiveChildrenCategories(String inode)List<Category>Returns a list of the active child categories for the parent category associated with the string passed in.
getActiveChildrenCategoriesOrderByName(Category cat)List<Category>Returns a list of the active child categories in order by name for the parent category passed in.
getActiveChildrenCategoriesOrderByName(Inode inode)List<Category>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<Category>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<Category>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>

On this page

×

We Dig Feedback

Selected excerpt:

×