Pimcore\Model\Element\Tag::getElementsForTag PHP Method

getElementsForTag() public static method

Retrieves all elements that have a specific tag or one of its child tags assigned
public static getElementsForTag ( Tag $tag, string $type, array $subtypes = [], array $classNames = [], boolean $considerChildTags = false ) : array
$tag Tag The tag to search for
$type string The type of elements to search for: 'document', 'asset' or 'object'
$subtypes array Filter by subtypes, eg. page, object, email, folder etc.
$classNames array For objects only: filter by classnames
$considerChildTags boolean Look for elements having one of $tag's children assigned
return array
    public static function getElementsForTag(Tag $tag, $type, array $subtypes = [], $classNames = [], $considerChildTags = false)
    {
        return $tag->getDao()->getElementsForTag($tag, $type, $subtypes, $classNames, $considerChildTags);
    }