Get multiple attributes value at once

Permalink
is there any way to getting multiple attribute value?

for getting single attribute :
$page->getAttribute($attr);

& for ["att1", "att2", "att3", "..."] ?

 
mnakalay replied on at Permalink Reply
mnakalay
Attribute categories have a getAttributeValues() function you should be able to use for that. So for pages, you would do:
use Concrete\Core\Support\Facade\Application;
use Concrete\Core\Attribute\Category\PageCategory;
$app = Application::getFacadeApplication();
$pageCategory = $app->make(PageCategory::class);
$values = $pageCategory->getAttributeValues($page);
foreach($values as $value) {
    // here I am using getPlainTextValue() but you can also use
    // getGenericValue() or getDisplayValue()
    echo $value->getPlainTextValue();
}