Snippet to get tagger alias from tag name/label

Can anyone give me an example of how I might get the a tagger tag alias via a snippet if I send up the group id and the tag name?

The FRED tagger element setting only returns a tagger name or label - I’m not sure which, but it’s not the alias and I need it to be the alias for what I’m doing.

I’ve tried wrapping my head around xpdo and I can’t find any good examples for this and am getting nowhere.

I’ve had basic success in the past with custom tables of my own mostly copying and pasting xpdo “examples” I’ve seen around the web, but to be honest I don’t think I really understand them.


Sometimes you get lucky after beating around the same bush for hours. Found my solution…which I was sure I had hours ago… but I’m sure had something minor wrong with it :slight_smile:

This however, works as I need for now. I would like to see an option added to the FRED tagger option to return the alias instead of the label… or even better, both in an object.

/** @var Tagger $tagger */
$tagger = $modx->getService('tagger', 'Tagger', $modx->getOption('tagger.core_path', null, $modx->getOption('core_path') . 'components/tagger/') . 'model/tagger/', $scriptProperties);
if (!($tagger instanceof Tagger))
    return '';
$c = $modx->newQuery('TaggerTag');
$c->where(array('group' => $groupID,'label' => $tagName));

$tagResult = $modx->getObject('TaggerTag',$c);
$thisTagAlias = $tagResult->get("alias");
return $thisTagAlias;

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”.