本文整理汇总了PHP中ModuleModel::findByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleModel::findByPK方法的具体用法?PHP ModuleModel::findByPK怎么用?PHP ModuleModel::findByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleModel
的用法示例。
在下文中一共展示了ModuleModel::findByPK方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRuntimeNavClass
/**
* Set runtime navigation class.
*
* This method is triggered by the isVisibleElement Hook. This means that when being logged in as backend user
* using the frontend preview it does not work!
*
* @param \Model $element Current element model.
* @param bool $isVisible Visible state.
*
* @return bool
*/
public static function setRuntimeNavClass(\Model $element, $isVisible)
{
// load module if it is a module include element
if ($element instanceof \ContentModel && $element->type == 'module') {
$element = \ModuleModel::findByPK($element->module);
}
if (!$element instanceof \ModuleModel) {
return $isVisible;
}
// do not limit for navigation module. so every module can access it
// bootstrap_inNavbar is dynamically set of navbar module
if ($element->bootstrap_inNavbar) {
$class = 'nav navbar-nav';
if ($element->bootstrap_navbarFloating == 'right') {
$class .= 'navbar-right';
}
} elseif ($element->bootstrap_navClass) {
$class = $element->bootstrap_navClass;
} else {
$class = 'nav nav-default';
}
Bootstrap::setConfigVar('runtime.nav-class', $class);
return $isVisible;
}
示例2: renderModule
protected function renderModule($objChild)
{
$objModule = \ModuleModel::findByPK($objChild->module);
if ($objModule === null) {
return '';
}
if (!\Controller::isVisibleElement($objModule)) {
return '';
}
$strClass = \Module::findClass($objModule->type);
if (!class_exists($strClass)) {
$this->log('Module class "' . $GLOBALS['FE_MOD'][$objModule->type] . '" (module "' . $objModule->type . '") does not exist', 'ModuleBlock renderModule()', TL_ERROR);
return '';
}
$objModule->typePrefix = 'mod_';
if (!$objChild->addWrapper) {
$objModule = $this->overrideCommonProps($objModule, $objChild);
}
$objModule = new $strClass($objModule);
return $objModule->generate();
}
示例3: getColumnsForModule
/**
* Get columns for a a specific module.
*
* @param \DataContainer $dataContainer The data container driver.
*
* @return array
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getColumnsForModule($dataContainer)
{
if ($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
$subcolumns = new \tl_module_sc();
return $subcolumns->getColumns($dataContainer);
}
$model = \ModuleModel::findByPK($dataContainer->currentRecord);
$cols = array();
$translate = array('first', 'second', 'third', 'fourth', 'fith');
for ($i = 0; $i < $model->sc_type; $i++) {
if (!array_key_exists($i, $translate)) {
break;
}
$key = $translate[$i];
$cols[$key] = $GLOBALS['TL_LANG']['MSC']['sc_' . $key];
}
return $cols;
}