/** * @param ApplicationFacet $applicationFacet * @return FacetBase */ public static function factory(ApplicationFacet $applicationFacet) { $facetImplement = self::getFacetImplementationClass($applicationFacet->attribute('facet_type')); if ( $facetImplement && class_exists($facetImplement) ) { $facetType = $facetImplement::facetType(); $facetTranslation = $applicationFacet->title; $usableFacet = new $facetImplement( (int)$applicationFacet->attribute('ux_type'), $facetTranslation, $applicationFacet->getTaxonomyCategoryIdentifier() ); self::setUsableFacetProperty( $usableFacet, 'can_be_hidden' , $applicationFacet->attribute('can_be_hidden') ); self::setUsableFacetProperty( $usableFacet, 'hide_empty_values' , $applicationFacet->attribute('hide_empty_values') ); self::setUsableFacetProperty( $usableFacet, 'on_mobile' , $applicationFacet->attribute('on_mobile') ); } else { return null; } return $usableFacet; }
/** * @return ApplicationFacet */ public function getFacet() { $conditions = array ( 'id' => $this->attribute('application_facet_id') ); $facet = ApplicationFacet::fetchObject( ApplicationFacet::definition(), null, $conditions ); if ( $facet instanceof ApplicationFacet ) { $facet->buildFacetConfiguration(); } return $facet; }