本文整理汇总了PHP中ContentElement::findClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentElement::findClass方法的具体用法?PHP ContentElement::findClass怎么用?PHP ContentElement::findClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentElement
的用法示例。
在下文中一共展示了ContentElement::findClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseTemplate
/**
* Add the html attribute to allowed elements
*
* @param \Template $objTemplate
*/
public function parseTemplate($objTemplate)
{
if (!$objTemplate instanceof \FrontendTemplate || !$objTemplate->allowAjaxReload) {
return;
}
// Determine whether we have a module or a content element by the vars given at this point
if (\Module::findClass($objTemplate->type)) {
$strType = 'mod';
} elseif (\ContentElement::findClass($objTemplate->type)) {
$strType = 'ce';
} else {
return;
}
// Some elements use the auto_item which we need to pass
$strAutoItem = Input::getAutoItem('auto_item');
// cssID is parsed in all common templates
// Use cssID for our attribute
$objTemplate->cssID .= sprintf(' data-ajax-reload-element="%s::%u"%s%s', $strType, $objTemplate->id, strlen($strAutoItem) ? sprintf(' data-ajax-reload-auto-item="%s"', $strAutoItem) : '', $objTemplate->ajaxReloadFormSubmit ? ' data-ajax-reload-form-submit=""' : '');
}
示例2: findContentElement
/**
* Find a content element in the TL_CTE array and return the class name
*
* @param string $strName The content element name
*
* @return string The class name
*
* @deprecated Use ContentElement::findClass() instead
*/
public static function findContentElement($strName)
{
return \ContentElement::findClass($strName);
}
示例3: getContentElementAjax
/**
* Generate a content element and return it as string
*
* @param mixed $intId A content element ID or a Model object
* @param string $strColumn The column the element is in
*
* @return string The content element HTML markup
*/
protected static function getContentElementAjax($intId, $strColumn = 'main')
{
if (is_object($intId)) {
$objRow = $intId;
} else {
if (!strlen($intId) || $intId < 1) {
return '';
}
$objRow = \ContentModel::findByPk($intId);
if ($objRow === null) {
return '';
}
}
// Check the visibility (see #6311)
if (!static::isVisibleElement($objRow)) {
return '';
}
$strClass = \ContentElement::findClass($objRow->type);
// Return if the class does not exist
if (!class_exists($strClass)) {
\System::log('Content element class "' . $strClass . '" (content element "' . $objRow->type . '") does not exist', __METHOD__, TL_ERROR);
return '';
}
$objRow->typePrefix = 'ce_';
$objElement = new $strClass($objRow, $strColumn);
$strBuffer = AjaxInput::get('g') == '1' ? $objElement->generate() : $objElement->generateAjax();
// HOOK: add custom logic
if (isset($GLOBALS['TL_HOOKS']['getContentElement']) && is_array($GLOBALS['TL_HOOKS']['getContentElement'])) {
foreach ($GLOBALS['TL_HOOKS']['getContentElement'] as $callback) {
$strBuffer = static::importStatic($callback[0])->{$callback}[1]($objRow, $strBuffer, $objElement);
}
}
return $strBuffer;
}