本文整理汇总了PHP中Kwc_Abstract::hasSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract::hasSetting方法的具体用法?PHP Kwc_Abstract::hasSetting怎么用?PHP Kwc_Abstract::hasSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract
的用法示例。
在下文中一共展示了Kwc_Abstract::hasSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initFields
protected function _initFields()
{
parent::_initFields();
$this->setCreateMissingRow(true);
if (!$this->getClass()) {
return;
}
$generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
$classes = $generators['child']['component'];
foreach ($classes as $key => $class) {
if (!$class) {
continue;
}
$form = Kwc_Abstract_Form::createChildComponentForm($this->getClass(), "-{$key}", $key);
if ($form && count($form->fields)) {
if ($this->_getIdTemplateForChild($key)) {
$form->setIdTemplate($this->_getIdTemplateForChild($key));
}
if (!$this->_createFieldsets || !Kwc_Abstract::hasSetting($class, 'componentName')) {
$this->add($form);
} else {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($class, 'componentName'));
$name = str_replace('.', ' ', $name);
$this->add(new Kwf_Form_Container_FieldSet($name))->setName($key)->add($form);
}
}
}
}
示例2: getChainedSettings
public static function getChainedSettings($settings, $masterComponentClass, $prefix = 'Cc', $copySettings = array(), $copyFlags = array())
{
$ret = $settings;
if (!$masterComponentClass) {
throw new Kwf_Exception("This component requires a parameter");
}
$ret['masterComponentClass'] = $masterComponentClass;
$ret['alternativeComponents'] = array();
if (Kwc_Abstract::getFlag($masterComponentClass, 'hasAlternativeComponent')) {
$masterCCCls = strpos($masterComponentClass, '.') ? substr($masterComponentClass, 0, strpos($masterComponentClass, '.')) : $masterComponentClass;
$alternativeComponents = call_user_func(array($masterCCCls, 'getAlternativeComponents'), $masterComponentClass);
foreach ($alternativeComponents as $acKey => $alternativeComponent) {
$ret['alternativeComponents'][$acKey] = self::getChainedComponentClass($alternativeComponent, $prefix);
}
}
$ret['generators'] = Kwc_Abstract::getSetting($masterComponentClass, 'generators');
foreach ($ret['generators'] as $k => $g) {
$ret['generators'][$k] = self::createChainedGenerator($masterComponentClass, $k, $prefix);
}
foreach ($copySettings as $i) {
if (Kwc_Abstract::hasSetting($masterComponentClass, $i)) {
$ret[$i] = Kwc_Abstract::getSetting($masterComponentClass, $i);
}
}
foreach ($copyFlags as $f) {
$flags = Kwc_Abstract::getSetting($masterComponentClass, 'flags', false);
if (isset($flags[$f])) {
$ret['flags'][$f] = $flags[$f];
}
}
return $ret;
}
示例3: getLanguages
public static function getLanguages()
{
$config = Zend_Registry::get('config');
$langs = array();
if ($config->webCodeLanguage) {
$langs[] = $config->webCodeLanguage;
}
$possibleUserLanguages = array();
if ($config->languages) {
foreach ($config->languages as $lang => $name) {
$possibleUserLanguages[] = $lang;
}
}
$userModel = Kwf_Registry::get('userModel');
if (isset($userModel->getAuthedUser()->language) && $userModel->getAuthedUser()->language && in_array($userModel->getAuthedUser()->language, $possibleUserLanguages)) {
$langs[] = $userModel->getAuthedUser()->language;
}
if (Kwf_Component_Data_Root::getComponentClass()) {
$lngClasses = array();
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('language', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
$lngClasses[] = $c;
}
}
$lngs = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($lngClasses, array('ignoreVisible' => true));
foreach ($lngs as $c) {
if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($userModel->getAuthedUser(), $c)) {
$langs[] = $c->getLanguage();
}
}
}
return array_unique($langs);
}
示例4: componentWithMaster
public function componentWithMaster(array $componentWithMaster)
{
$last = array_pop($componentWithMaster);
$component = $last['data'];
if ($last['type'] == 'master') {
$innerComponent = $componentWithMaster[0]['data'];
$vars = $component->getComponent()->getMasterTemplateVars($innerComponent, $this->_getRenderer());
$vars['componentWithMaster'] = $componentWithMaster;
if (Kwc_Abstract::hasSetting($component->componentClass, 'masterTemplate')) {
$masterTemplate = Kwc_Abstract::getSetting($component->componentClass, 'masterTemplate');
} else {
$masterTemplate = $this->_getRenderer()->getTemplate($component, 'Master');
}
if (substr($masterTemplate, -4) == '.tpl') {
$view = new Kwf_Component_View($this->_getRenderer());
$view->assign($vars);
$ret = $view->render($masterTemplate);
} else {
$twig = new Kwf_Component_Renderer_Twig_Environment($this->_getRenderer());
$ret = $twig->render($masterTemplate, $vars);
}
$ret = $this->_replaceKwfUp($ret);
return $ret;
} else {
if ($last['type'] == 'component') {
$helper = new Kwf_Component_View_Helper_Component();
$helper->setRenderer($this->_getRenderer());
return '<div class="kwfMainContent">' . "\n " . $helper->component($component) . "\n" . '</div>' . "\n";
} else {
throw new Kwf_Exception("invalid type");
}
}
}
示例5: validateSettings
public static function validateSettings($settings, $componentClass)
{
parent::validateSettings($settings, $componentClass);
if (Kwc_Abstract::hasSetting($componentClass, 'dimensions')) {
throw new Kwf_Exception("Setting 'dimensions' must NOT exist");
}
}
示例6: __construct
public function __construct($resourceId, $menuConfig = null, $menuUrl = null, Kwf_Component_Data $component = null)
{
if ($resourceId instanceof Kwf_Component_Data) {
$component = $resourceId;
$resourceId = 'kwc_' . $component->dbId;
} else {
if (!$component) {
throw new Kwf_Exception("component parameter is required");
}
}
$this->_component = $component;
if (!$menuConfig) {
if (Kwc_Abstract::hasSetting($this->_class, 'componentNameShort')) {
$name = Kwc_Abstract::getSetting($this->_class, 'componentNameShort');
} else {
$name = Kwc_Abstract::getSetting($this->_class, 'componentName');
}
$icon = Kwc_Abstract::getSetting($component->componentClass, 'componentIcon');
$menuConfig = array('text' => trlKwfStatic('Edit {0}', $name), 'icon' => $icon);
}
if (!$menuUrl) {
$menuUrl = Kwc_Admin::getInstance($component->componentClass)->getControllerUrl() . '?componentId=' . $component->dbId;
}
parent::__construct($resourceId, $menuConfig, $menuUrl);
}
示例7: callModifyItemData
public final function callModifyItemData(Kwf_Component_Data $item)
{
foreach (Kwc_Abstract::getChildComponentClasses($this->getData()->componentClass) as $c) {
if (Kwc_Abstract::hasSetting($c, 'hasModifyItemData') && Kwc_Abstract::getSetting($c, 'hasModifyItemData')) {
call_user_func(array(strpos($c, '.') ? substr($c, 0, strpos($c, '.')) : $c, 'modifyItemData'), $item, $c);
}
}
}
示例8: _getConfig
protected function _getConfig()
{
$componentList = array();
$componentIcons = array();
$categories = Kwc_Abstract::getSetting($this->_class, 'categories');
foreach ($categories as $k => $i) {
$categories[$k] = Kwf_Registry::get('trl')->trlStaticExecute($i);
$componentList[$categories[$k] . '>>'] = array();
}
$components = $this->_getComponents();
uasort($components, array('Kwc_Paragraphs_ExtConfig', '_sortByPriority'));
foreach ($components as $component) {
if (!Kwc_Abstract::hasSetting($component, 'componentName')) {
continue;
}
$name = Kwc_Abstract::getSetting($component, 'componentName');
$name = Kwf_Registry::get('trl')->trlStaticExecute($name);
$icon = Kwc_Abstract::getSetting($component, 'componentIcon');
if ($icon) {
$icon = new Kwf_Asset($icon);
$icon = $icon->__toString();
}
if ($name) {
$cat = null;
if (Kwc_Abstract::hasSetting($component, 'componentCategory')) {
$cat = Kwc_Abstract::getSetting($component, 'componentCategory');
if (isset($categories[$cat])) {
$cat = $categories[$cat];
}
}
if (!$cat) {
$cat = 'none';
}
if (substr($name, 0, strlen($cat) + 1) != $cat . '.') {
$name = $cat . '.' . $name;
}
$this->_componentNameToArray($name, $component, $componentList);
$componentIcons[$component] = $icon;
}
}
//move content and none to top level
$componentList = array_merge($componentList['content>>'], $componentList['none>>'], $componentList);
unset($componentList['content>>']);
unset($componentList['none>>']);
//remove empty categories
foreach ($componentList as $k => $i) {
if (!$i) {
unset($componentList[$k]);
}
}
$config = $this->_getStandardConfig('kwc.paragraphs');
$config['showDeviceVisible'] = Kwc_Abstract::getSetting($this->_class, 'useMobileBreakpoints');
$config['components'] = $componentList;
$config['componentIcons'] = $componentIcons;
$config['needsComponentPanel'] = true;
return array('paragraphs' => $config);
}
示例9: _getOptions
protected function _getOptions()
{
$ret = array();
if (Kwc_Abstract::hasSetting($this->_data->componentClass, 'lightboxOptions')) {
$ret = Kwc_Abstract::getSetting($this->_data->componentClass, 'lightboxOptions');
}
$ret['width'] = $this->_data->getComponent()->getContentWidth();
return $ret;
}
示例10: getSelect
public function getSelect()
{
$class = $this->getData()->parent->parent->componentClass;
$childReference = Kwc_Abstract::hasSetting($class, 'childReferenceName') ? Kwc_Abstract::getSetting($class, 'childReferenceName') : 'Categories';
$select = parent::getSelect();
$s = new Kwf_Model_Select();
$s->whereEquals('category_id', $this->getData()->parent->id);
$select->where(new Kwf_Model_Select_Expr_Child_Contains($childReference, $s));
return $select;
}
示例11: _buildAll
/**
* @internal
*/
public static function _buildAll($componentClasses)
{
foreach ($componentClasses as $cmp) {
if (Kwc_Abstract::hasSetting($cmp, 'layoutClass')) {
self::$_supportedContexts[$cmp] = self::getInstance($cmp)->calcSupportedContexts();
self::$_supportedChildContexts[$cmp] = self::getInstance($cmp)->calcSupportedChildContexts();
}
}
$data = array('contexts' => self::$_supportedContexts, 'childContexts' => self::$_supportedChildContexts);
file_put_contents('build/component/layoutcontexts', serialize($data));
}
示例12: getUpdateTags
/**
* Returns all udpate tags used by this webs. They are usually set in config.ini
**/
public static function getUpdateTags()
{
if (!isset(self::$_updateTagsCache)) {
self::$_updateTagsCache = Kwf_Registry::get('config')->server->updateTags->toArray();
foreach (Kwf_Component_Abstract::getComponentClasses() as $class) {
if (Kwc_Abstract::hasSetting($class, 'updateTags')) {
self::$_updateTagsCache = array_unique(array_merge(self::$_updateTagsCache, Kwc_Abstract::getSetting($class, 'updateTags')));
}
}
}
return self::$_updateTagsCache;
}
示例13: _getRow
protected function _getRow($componentId)
{
if (!Kwc_Abstract::hasSetting($this->_class, 'tablename')) {
return null;
}
$tablename = Kwc_Abstract::getSetting($this->_class, 'tablename');
if ($tablename) {
$table = new $tablename(array('componentClass' => $this->_class));
return $table->find($componentId)->current();
}
return null;
}
示例14: _getDefaultValues
/**
* Set default vCard settings here or in Team_Component
*/
protected function _getDefaultValues()
{
$teamComponent = $this->_data->chained->parent->parent->parent;
if (Kwc_Abstract::hasSetting($teamComponent->componentClass, 'defaultVcardValues')) {
$setting = Kwc_Abstract::getSetting($teamComponent->componentClass, 'defaultVcardValues');
}
if (isset($setting)) {
return $setting;
} else {
return Kwc_Abstract::getSetting($this->_data->chained->componentClass, 'defaultVcardValues');
}
}
示例15: getTemplate
public function getTemplate(Kwf_Component_Data $component, $type)
{
if ($type == 'Master') {
if (Kwc_Abstract::hasSetting($component->componentClass, 'masterTemplate')) {
return Kwc_Abstract::getSetting($component->componentClass, 'masterTemplate');
}
}
$template = Kwc_Abstract::getTemplateFile($component->componentClass, $type);
if (!$template) {
throw new Kwf_Exception("No {$type}-Template found for '{$component->componentClass}'");
}
return $template;
}