public function chunk(Element $element) { $size = $element->getAttribute('data-size')->getValue(); $chunks = array_map(function ($chunk) { return new ListModel($chunk); }, array_chunk($this->item, $size)); return $chunks; }
private function wrapAsset(Element $element, $attributeName) { $attribute = $element->getAttribute($attributeName); if (!$attribute) { return; } $url = Url::fromString($attribute->getValue()); if ($url->isAbsolute()) { return; } $path = $url->getPath(); $path->insertAll($this->path->slice(0, -1), 0); $url->setPath($path); $element->setAttribute($attributeName, $url->toString()); }
private function getPropertyName(Element $element) { return $element->getAttribute('property')->getValue(); }