/** * Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::getSchemaFields(). */ public function getSchemaFields($schema) { $schema_fields = array(); $rdf_mappings = rich_snippets_get_rdf_schema_mappings($this->_entityType, $this->_bundle); if (!empty($rdf_mappings[$schema])) { foreach ($rdf_mappings[$schema] as $field_name) { $items = field_get_items($this->_entityType, $this->_entity, $field_name); $schema_fields[$field_name] = $items ? $items : array(); } } return $schema_fields; }
/** * Returns the entity field / Solr field mappings for all fields associated * with the passed schema. * * @param string $schema * The schema that mappings are generated for. * * @return array * An associative array keyed by schema field name to solr field name. */ public function getFieldSchemaMappings($schema) { $schema_mappings = array(); // Check if there are any fields associated with the requested schema. $this->_rdfMappings = rich_snippets_get_rdf_schema_mappings($this->_entityType, $this->_bundle); if (!empty($this->_rdfMappings[$schema])) { // If so, get the Solr field name associated with the Drupal field name. $key_mappings = apachesolr_get_index_key_map($this->_entityType); foreach ($this->_rdfMappings[$schema] as $field_name) { if (isset($key_mappings[$field_name])) { $schema_mappings[$field_name] = $key_mappings[$field_name]; } } } return $schema_mappings; }