public function loop()
{
$disabled = false;
$options = $this->getOptions();
$manual = false;
if (is_array($options) && array_key_exists("manual", $options) && $options["manual"] == true) {
$manual = true;
}
if ($this->current > 0) {
if (!$manual && $this->blockStarted) {
$this->blockDestruct();
$this->blockEnd();
$this->blockStarted = false;
}
} else {
if (!$manual) {
$this->start();
}
}
if ($this->current < count($this->indices) && $this->current < $this->options["limit"]) {
$index = current($this->indices);
next($this->indices);
$this->currentIndex = $index;
if (!empty($options["allowed"]) && !in_array($index["type"], $options["allowed"])) {
$disabled = true;
}
if (!$this->isBrickEnabled($index["type"]) && $options['dontCheckEnabled'] != true) {
$disabled = true;
}
$this->blockStarted = false;
if (!$manual && !$disabled) {
$this->blockConstruct();
$this->blockStart();
$this->blockStarted = true;
$this->content();
} elseif (!$manual) {
$this->current++;
}
return true;
} else {
if (!$manual) {
$this->end();
}
return false;
}
}