Provides a Tag field for ProcessWire CMS pages.
Just clone or put this into a folder and install the module from the module admin page of ProcessWire.
Just access this field like any other field of ProcessWire. This field returns an normal PHP Array.
// Fetch the tag field. Here it's called "Tags'.
$tags = $page->Tags;
foreach($tags as $tag) {
echo "Tag: " . $tag;
}
// Retrieve the module
$tags = $this('modules')->get("FieldtypeTags");
// Fetch all tags and their frequency.
foreach($tags->getAllTags("Tags") as $field => $count) {
echo "<h2>Tag \"{$field}\" (used {$count} times)</h2>";
echo "<ul>";
// Fetch all pages for a given tag
foreach($tags->getPagesByTag($field) as $page) {
echo "<li><a href=\"{$page->url}\">{$page->title}</a></li>";
}
echo "</ul>";
}
As far as I know, there are currently no single input input fields that output arrays. Maybe you should consider to use the InputfieldTagify I created for this fieldtype.