public function NodeRegistrationNodeSettings::capacity in Node registration 7
The capacity for this event.
File
- includes/
node_registration.node_settings.inc, line 79 - Node settings class.
Class
- NodeRegistrationNodeSettings
- Node settings class.
Code
public function capacity() {
return $this
->_cache(__FUNCTION__, function ($settings) {
// Use capacity from node field.
if ($capacity_field = $settings->capacity_field) {
$items = field_get_items('node', $settings->node, $capacity_field);
if ($items) {
$item = $items[0];
return max(0, (int) $item['value']);
}
// No max.
return 0;
}
// Use capacity from node settings or registration type settings.
return max(0, (int) $settings
->setting('capacity', 0));
});
}