Search in sources :

Example 1 with PageTemplateFieldGroupXref

use of org.broadleafcommerce.cms.page.domain.PageTemplateFieldGroupXref in project BroadleafCommerce by BroadleafCommerce.

the class PageTemplateCustomPersistenceHandler method getFieldGroups.

protected List<FieldGroup> getFieldGroups(Page page, PageTemplate template) {
    List<PageTemplateFieldGroupXref> fieldGroupXrefs = null;
    List<FieldGroup> fieldGroups = new ArrayList<FieldGroup>();
    if (template != null) {
        fieldGroupXrefs = template.getFieldGroupXrefs();
    }
    if (page.getPageTemplate() != null) {
        fieldGroupXrefs = page.getPageTemplate().getFieldGroupXrefs();
    }
    if (fieldGroupXrefs != null) {
        for (PageTemplateFieldGroupXref xref : fieldGroupXrefs) {
            fieldGroups.add(xref.getFieldGroup());
        }
    }
    return fieldGroups;
}
Also used : PageTemplateFieldGroupXref(org.broadleafcommerce.cms.page.domain.PageTemplateFieldGroupXref) FieldGroup(org.broadleafcommerce.cms.field.domain.FieldGroup) ArrayList(java.util.ArrayList)

Example 2 with PageTemplateFieldGroupXref

use of org.broadleafcommerce.cms.page.domain.PageTemplateFieldGroupXref in project BroadleafCommerce by BroadleafCommerce.

the class PageServiceUtility method getFieldDefinition.

protected FieldDefinition getFieldDefinition(Page page, String fieldKey) {
    ExtensionResultHolder<FieldDefinition> erh = new ExtensionResultHolder<FieldDefinition>();
    ExtensionResultStatusType result = extensionManager.getProxy().getFieldDefinition(erh, page, fieldKey);
    if (result == ExtensionResultStatusType.HANDLED) {
        return erh.getResult();
    }
    if (page.getPageTemplate() != null) {
        for (PageTemplateFieldGroupXref fgXrefs : page.getPageTemplate().getFieldGroupXrefs()) {
            for (FieldDefinition fd : fgXrefs.getFieldGroup().getFieldDefinitions()) {
                if (fd.getName().equals(fieldKey)) {
                    return fd;
                }
            }
        }
    }
    return null;
}
Also used : PageTemplateFieldGroupXref(org.broadleafcommerce.cms.page.domain.PageTemplateFieldGroupXref) FieldDefinition(org.broadleafcommerce.cms.field.domain.FieldDefinition) ExtensionResultStatusType(org.broadleafcommerce.common.extension.ExtensionResultStatusType) ExtensionResultHolder(org.broadleafcommerce.common.extension.ExtensionResultHolder)

Aggregations

PageTemplateFieldGroupXref (org.broadleafcommerce.cms.page.domain.PageTemplateFieldGroupXref)2 ArrayList (java.util.ArrayList)1 FieldDefinition (org.broadleafcommerce.cms.field.domain.FieldDefinition)1 FieldGroup (org.broadleafcommerce.cms.field.domain.FieldGroup)1 ExtensionResultHolder (org.broadleafcommerce.common.extension.ExtensionResultHolder)1 ExtensionResultStatusType (org.broadleafcommerce.common.extension.ExtensionResultStatusType)1