public function ChecklistapiChecklist::__construct in Checklist API 7
Constructs a ChecklistapiChecklist object.
Parameters
array $definition: A checklist definition, as returned by checklistapi_get_checklist_info().
File
- lib/
Drupal/ checklistapi/ ChecklistapiChecklist.php, line 89 - Class for Checklist API checklists.
Class
- ChecklistapiChecklist
- Defines the checklist class.
Code
public function __construct(array $definition) {
foreach (element_children($definition) as $group_key) {
$this->numberOfItems += count(element_children($definition[$group_key]));
$this->items[$group_key] = $definition[$group_key];
unset($definition[$group_key]);
}
foreach ($definition as $property_key => $value) {
$property_name = checklistapi_strtolowercamel(drupal_substr($property_key, 1));
$this->{$property_name} = $value;
}
$this->savedProgress = variable_get($this
->getSavedProgressVariableName(), array());
}