use of org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO in project BroadleafCommerce by BroadleafCommerce.
the class SimpleSearchBreadcrumbServiceExtensionHandler method modifyBreadcrumbList.
@Override
public ExtensionResultStatusType modifyBreadcrumbList(String url, Map<String, String[]> params, ExtensionResultHolder<List<BreadcrumbDTO>> holder) {
String keyword = getSearchKeyword(url, params);
url = getBreadcrumbUrl(url, holder);
params = getBreadcrumbParams(params, holder);
if (!StringUtils.isEmpty(keyword)) {
BreadcrumbDTO searchDto = new BreadcrumbDTO();
searchDto.setText(keyword);
searchDto.setLink(buildLink(url, params));
searchDto.setType(BreadcrumbDTOType.SEARCH);
holder.getResult().add(0, searchDto);
updateContextMap(params, holder);
}
return ExtensionResultStatusType.HANDLED_CONTINUE;
}
use of org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO in project BroadleafCommerce by BroadleafCommerce.
the class HomePageBreadcrumbServiceExtensionHandler method modifyBreadcrumbList.
@Override
public ExtensionResultStatusType modifyBreadcrumbList(String url, Map<String, String[]> params, ExtensionResultHolder<List<BreadcrumbDTO>> holder) {
BreadcrumbDTO homePageDto = new BreadcrumbDTO();
homePageDto.setText(homePageText);
homePageDto.setLink("/");
homePageDto.setType(BreadcrumbDTOType.HOME);
holder.getResult().add(0, homePageDto);
return ExtensionResultStatusType.HANDLED_CONTINUE;
}
use of org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO in project BroadleafCommerce by BroadleafCommerce.
the class ProductBreadcrumbServiceExtensionHandler method modifyBreadcrumbList.
public ExtensionResultStatusType modifyBreadcrumbList(String url, Map<String, String[]> params, ExtensionResultHolder<List<BreadcrumbDTO>> holder) {
Product product = determineProduct(url, params, holder);
if (product != null) {
BreadcrumbDTO productDto = new BreadcrumbDTO();
productDto.setText(getNameForProductLink(product));
productDto.setLink(buildLink(url, params));
productDto.setType(BreadcrumbDTOType.PRODUCT);
holder.getResult().add(0, productDto);
}
updateContextMap(url, params, holder);
return ExtensionResultStatusType.HANDLED_CONTINUE;
}
use of org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO in project BroadleafCommerce by BroadleafCommerce.
the class CategoryBreadcrumbServiceExtensionHandler method addParentCrumbs.
/**
* Add the parent crumb for the passed in category.
* Recursively call to find all parents.
*
* @param parentCrumbs
* @param category
* @param url
* @param params
*/
protected void addParentCrumbs(List<BreadcrumbDTO> parentCrumbs, Category category, String url, Map<String, String[]> params) {
Category parentCategory = category.getParentCategory();
if (parentCategory != null && !parentCrumbs.contains(parentCategory)) {
// prevent recursion
BreadcrumbDTO dto = buildCrumbForCategory(parentCategory, url, params);
parentCrumbs.add(0, dto);
addParentCrumbs(parentCrumbs, parentCategory, url, params);
}
}
use of org.broadleafcommerce.common.breadcrumbs.dto.BreadcrumbDTO in project BroadleafCommerce by BroadleafCommerce.
the class CategoryBreadcrumbServiceExtensionHandler method buildCrumbForCategory.
protected BreadcrumbDTO buildCrumbForCategory(Category category, String url, Map<String, String[]> params) {
BreadcrumbDTO categoryDto = null;
if (category != null) {
categoryDto = new BreadcrumbDTO();
categoryDto.setText(getNameForCategoryLink(category));
categoryDto.setLink(category.getUrl());
categoryDto.setType(BreadcrumbDTOType.CATEGORY);
}
return categoryDto;
}
Aggregations