<?php
namespace Newland\Toubiz\Poi\Neos\ViewHelpers\Collection\Attributes;

use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
use Newland\Toubiz\Sync\Neos\Domain\Model\Article;
use Newland\Toubiz\Sync\Neos\Service\AttributeCollection;

class GetViewHelper extends AbstractViewHelper
{
    public function render(Article $article, string $attributeName): ?AttributeCollection
    {
        $attributes = $article->getFlatAttributes();

        return ($attributes[$attributeName] ?? null);
    }
}
