public function modify(array $structure)
{
if (TRUE === isset($structure['options']) && TRUE === is_array($structure['options'])) {
foreach ($structure['options'] as $name => $value) {
$this->setOption($name, $value);
}
unset($structure['options']);
}
if (TRUE === isset($structure['sheets'])) {
foreach ((array) $structure['sheets'] as $index => $sheetData) {
$sheetName = TRUE === isset($sheetData['name']) ? $sheetData['name'] : $index;
// check if field already exists - if it does, modify it. If it does not, create it.
if (TRUE === $this->has($sheetName)) {
$sheet = $this->get($sheetName);
} else {
$sheet = $this->createContainer('Sheet', $sheetName);
}
$sheet->modify($sheetData);
}
}
return parent::modify($structure);
}