From 2fc1034336cd9dd975ea6b5ac4f572fd151ad02f Mon Sep 17 00:00:00 2001 From: Olav Frengstad Date: Fri, 8 Jun 2012 17:04:46 +0200 Subject: [PATCH] Add support for CustomAttributeMap --- classes/ezfsolrdocumentfieldbase.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/classes/ezfsolrdocumentfieldbase.php b/classes/ezfsolrdocumentfieldbase.php index 39f20d64..0525f014 100644 --- a/classes/ezfsolrdocumentfieldbase.php +++ b/classes/ezfsolrdocumentfieldbase.php @@ -326,6 +326,21 @@ static function getInstance( eZContentObjectAttribute $objectAttribute ) } else { + $attributeMapList = self::$FindINI->variable('SolrFieldMapSettings', 'CustomAttributeMap'); + + if ( ! empty( $attributeMapList ) ) { + $contentClassId = $objectAttribute->attribute('contentclass_attribute')->attribute('contentclass_id'); + $contentClass = eZContentClass::fetch( $contentClassId ); + $identifierComposite = sprintf( '%s/%s', $contentClass->attribute('identifier'), + $objectAttribute->attribute('contentclass_attribute_identifier') ); + + if ( array_key_exists( $identifierComposite, $attributeMapList ) ) { + return self::$singletons[$objectAttribute->attribute( 'id' )] = new $attributeMapList[$identifierComposite]( $objectAttribute ); + } + + unset( $identifierComposite, $contentClass ); + } + $datatypeString = $objectAttribute->attribute( 'data_type_string' ); // Check if using custom handler.