/**
* @param $strTag
* @return bool|string
*/
public function setHooks($strTag)
{
$arrSplit = explode('::', $strTag);
// generate Template
if (($arrSplit[0] == 'fm_view' || $arrSplit[0] == 'fmView') && $arrSplit) {
return $this->generateTemplate($arrSplit);
}
// generate Field
if (($arrSplit[0] == 'fm_field' || $arrSplit[0] == 'fmField') && $arrSplit) {
return $this->generateField($arrSplit);
}
// get values from current item
if (($arrSplit[0] == 'fm_detail' || $arrSplit[0] == 'fmDetail') && $arrSplit) {
return $this->getDetailFieldValue($arrSplit);
}
// Generate URL
if (($arrSplit[0] == 'fm_url' || $arrSplit[0] == 'fmUrl') && count($arrSplit) > 2) {
return $this->getUrlFromItem($arrSplit);
}
// Get active values
if ($arrSplit[0] == 'fm_active' || $arrSplit[0] == 'fmActive') {
return $this->getActiveFieldValue($arrSplit);
}
// Count Items
if (($arrSplit[0] == 'fm_count' || $arrSplit[0] == 'fmCount') && $arrSplit[1]) {
$tablename = $arrSplit[1];
$tableData = $tablename . '_data';
$qPid = $arrSplit[2] ? ' AND pid = "' . $arrSplit[2] . '"' : '';
$q = $arrSplit[3] ? Input::decodeEntities($arrSplit[3]) : '';
$q = str_replace('[&]', '&', $q);
if ($q) {
$arrFilter = $this->getFilterFields($q, $tablename);
$qResult = HelperModel::generateSQLQueryFromFilterArray($arrFilter);
$q = $qResult['qStr'];
}
if ($this->Database->tableExists($tableData)) {
return $this->Database->prepare('SELECT id FROM ' . $tableData . ' WHERE published = "1"' . $qPid . $q . '')->query()->count();
}
return '0';
}
return false;
}