private function views_oai_pmh_plugin_row_auto::_check_row_objects in Views OAI-PMH 7.2
Same name and namespace in other branches
- 6.2 plugins/views_oai_pmh_plugin_row_auto.inc \views_oai_pmh_plugin_row_auto::_check_row_objects()
Clones this object's properties into its row objects. Only performs this action the first time the function is called; subsequent calls just run the validity test.
Return value
boolean TRUE if the objects are OK, FALSE if not.
4 calls to views_oai_pmh_plugin_row_auto::_check_row_objects()
- views_oai_pmh_plugin_row_auto::options_form in plugins/
views_oai_pmh_plugin_row_auto.inc - Provide a form for setting options.
- views_oai_pmh_plugin_row_auto::options_submit in plugins/
views_oai_pmh_plugin_row_auto.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
- views_oai_pmh_plugin_row_auto::render in plugins/
views_oai_pmh_plugin_row_auto.inc - Render a row object. This usually passes through to a theme template of some form, but not always.
- views_oai_pmh_plugin_row_auto::validate in plugins/
views_oai_pmh_plugin_row_auto.inc - Validate that the plugin is correct and can be saved.
File
- plugins/
views_oai_pmh_plugin_row_auto.inc, line 46 - Definition of the views_oai_pmh_plugin_row_auto class.
Class
Code
private function _check_row_objects() {
// Filter out row plugins that aren't appropriate to this style plugin.
$row_plugin = $this->view->display[$this->view->current_display]->handler->options['row_plugin'];
if ($row_plugin != 'auto' && !in_array($row_plugin, $GLOBALS['views_oai_pmh'])) {
return FALSE;
}
// Check to see if the $_row_objects array has not been populated already.
if (!$this->_row_objects_populated) {
// We'll use these two variables to determine the metadata type to use:
// 1) The "metadataPrefix" parameter from the query string.
$metadata_prefix = array_key_exists('metadataPrefix', $_GET) && $_GET['metadataPrefix'] != '' ? $_GET['metadataPrefix'] : '';
// 2) The active row plugin from the View (see above).
// If we're set to use the Auto row plugin, then use the metadataPrefix parameter from the query string.
if ($row_plugin == 'auto' && array_key_exists($metadata_prefix, $GLOBALS['views_oai_pmh'])) {
$this->_metadata_format = $metadata_prefix;
}
elseif ($row_plugin != '' && $row_plugin != 'auto') {
$this->_metadata_format = $row_plugin;
}
else {
$this->_metadata_format = $GLOBALS['views_oai_pmh_default'];
}
// Examine each value in the array of row objects, which should all be unconfigured at this point.
foreach ($this->_row_objects as $key => $row_object) {
// Populate each row object with the properties of this 'Auto' object.
foreach ($this as $property => $value) {
switch ($property) {
// Don't apply the properties that are unique to the 'Auto' class.
case '_row_objects':
case '_row_objects_populated':
case '_metadata_format':
break;
// We need to overwrite the theme-related properties with themes appropriate to the object type we're creating.
case 'definition':
$value['theme'] = $GLOBALS['views_oai_pmh'][$this->_metadata_format]->field_theme;
$value['handler'] = $GLOBALS['views_oai_pmh'][$this->_metadata_format]->handler;
$this->_row_objects[$key]->{$property} = $value;
break;
// Create/set the property in the row object.
default:
$this->_row_objects[$key]->{$property} = $value;
break;
}
}
}
// Flag the object population code as complete so this block doesn't run again.
$this->_row_objects_populated = TRUE;
}
// Check each individual array item for a valid object of type 'views_oai_pmh_plugin_row_misc', returning a failure if we encounter any errors.
foreach ($this->_row_objects as $obj) {
if (!is_object($obj) || get_class($obj) != 'views_oai_pmh_plugin_row_misc') {
return FALSE;
}
}
return TRUE;
}