function openlayers_behavior_definition_check in Openlayers 7.2
Check the plugin definition of a behavior. Some field *MUST* be there to work correctly with OL.
Parameters
$definition:
Return value
bool
1 string reference to 'openlayers_behavior_definition_check'
- openlayers_behaviors in ./
openlayers.module - Get all behaviors.
File
- ./
openlayers.module, line 515 - Main OpenLayers API File
Code
function openlayers_behavior_definition_check($definition) {
$mandatory_fields = array(
array(
'title',
),
array(
'description',
),
array(
'name',
),
array(
'path',
),
array(
'type',
),
array(
'behavior',
'file',
),
array(
'behavior',
'class',
),
array(
'behavior',
'parent',
),
);
foreach ($mandatory_fields as $field) {
$missing = drupal_array_nested_key_exists($definition, $field);
if (!$missing) {
drupal_set_message(t("Key !key is missing in the definition of the behavior <em>!behavior</em>. The behavior will be disabled.", array(
'!key' => htmlspecialchars(implode(', ', $field)),
'!behavior' => htmlspecialchars($definition['name']),
)), 'warning');
watchdog('openlayers', 'Behavior !behavior is unavailable because its
plugin definition is incomplete.', array(
'!behavior' => $definition['name'],
), WATCHDOG_ERROR);
return FALSE;
}
}
return TRUE;
}