Getting tags from Articles as a comma separated string

I’m hoping this is possible since I found out the hard way that [[+tags]] in an Articles resource is actually a placeholder for a snippet that is much more complex than I was hoping to get. Ideally I’d be able to get it as tagA,tagB,tagC but I’m not sure where the tags are even kept. Doing something like:

<?php

$resource = $modx->getObject('modResource', 10);

$modx->log(1, print_r($resource, true));

Doesn’t show the tags input field in the resource. Ideally I’d like to get them programmatically in a snippet from a resource ID.

I believe Articles uses the extra tagLister for handling the tags and if I recall correctly, these are stored as a template variable.

I was looking at tagLister but I don’t think it does what I need. I am just trying to get the tags as a string, not a whole bunch of templating and linking to a specific page.

When I try to get the [[+tv.articlestags]] that Articles uses inside of pdoResources (I am sure to add it to &includeTVs) it doesn’t show anything.

I don’t know.
It seems to be a normal TV and returns the correct result when I test it with (MODX 3) code like this:

use MODX\Revolution\modResource;

$resource = $modx->getObject(modResource::class, 10);
$tags = $resource->getTVValue('articlestags');
return $tags;

or when using pdoResources:

[[pdoResources?
    &tpl=`@INLINE [[+tv.articlestags]]`
    &includeTVs=`articlestags`
    &resources=`10`
    &parents=`0`
]]

No, this one’s on me, I see where I went wrong. I was using $resource->get not $resource->getTVValue -_-

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.