public function views_oai_pmh_plugin_row_misc::construct in Views OAI-PMH 7.2
Same name and namespace in other branches
- 6.2 plugins/views_oai_pmh_plugin_row_misc.inc \views_oai_pmh_plugin_row_misc::construct()
Class constructor-like function. 'Views' calls this when it creates the object. Takes a metadata format type, such as 'oai_dc' for Dublin Core, as a parameter. This is used to grab the necessary details of the format whenever required from the $GLOBALS['views_oai_pmh'] configuration array. If the value is not provided, it will attempt to detect it automatically from the query string.
Parameters
string $type The metadata format type.:
Overrides views_object::construct
File
- plugins/
views_oai_pmh_plugin_row_misc.inc, line 30 - Definition of the views_oai_pmh_plugin_row_misc class.
Class
- views_oai_pmh_plugin_row_misc
- @file Definition of the views_oai_pmh_plugin_row_misc class.
Code
public function construct($type = '') {
if ($type) {
// Save the given metadata format value.
$this->_metadata_format = $type;
}
else {
// See if a particular data type is being requested in the query string.
$metadata_prefix = array_key_exists('metadataPrefix', $_GET) && $_GET['metadataPrefix'] != '' ? $_GET['metadataPrefix'] : '';
if (array_key_exists($metadata_prefix, $GLOBALS['views_oai_pmh'])) {
// Save the metadata format in this object's property.
$this->_metadata_format = $metadata_prefix;
}
elseif (array_key_exists('#metadata_format', $this->definition) && $this->definition['#metadata_format'] != '') {
// See if the selected data type contains the metadata format we need to use.
$this->_metadata_format = $this->definition['#metadata_format'];
}
}
// Create our root XML node to build upon using the global data type definition.
$this->nodes = new views_oai_pmh_xml_node($GLOBALS['views_oai_pmh'][$this->_metadata_format]->base_xml_node->key, $GLOBALS['views_oai_pmh'][$this->_metadata_format]->base_xml_node->value, $GLOBALS['views_oai_pmh'][$this->_metadata_format]->base_xml_node->attributes);
}