fetchByComponentSiteCode() public static method

Получение настроек для компонента по коду сайта.
public static fetchByComponentSiteCode ( Component $component, string $site_code ) : static
$component skeeks\cms\base\Component компонент с настройками
$site_code string код сайта
return static
Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function getDataCellValue($model, $key, $index)
 {
     $settings = null;
     if ($this->component === null) {
         return $this->_result(Cms::BOOL_N);
     }
     if ($model instanceof CmsSite) {
         $settings = \skeeks\cms\models\CmsComponentSettings::fetchByComponentSiteCode($this->component, $model->code);
     }
     if ($model instanceof User) {
         $settings = \skeeks\cms\models\CmsComponentSettings::fetchByComponentUserId($this->component, $model->id);
     }
     if ($settings) {
         return $this->_result(Cms::BOOL_Y);
     }
     return $this->_result(Cms::BOOL_N);
 }
Ejemplo n.º 2
0
 /**
  * Настройки для сайта
  * @param (string) $site_code
  * @return array
  */
 public function fetchDefaultSettingsBySiteCode($site_code)
 {
     $settings = CmsComponentSettings::fetchByComponentSiteCode($this, (string) $site_code);
     if (!$settings) {
         return [];
     }
     return (array) $settings->value;
 }
Ejemplo n.º 3
0
Archivo: site.php Proyecto: Liv1020/cms
?>


    <h2><?php 
echo \Yii::t('app', 'Settings for the site');
?>
: <?php 
echo $site->name;
?>
 (<?php 
echo $site->code;
?>
)</h2>
    <div class="sx-box sx-mb-10 sx-p-10">
        <?php 
if ($settings = \skeeks\cms\models\CmsComponentSettings::fetchByComponentSiteCode($component, $site->code)) {
    ?>
            <button type="submit" class="btn btn-danger btn-xs" onclick="sx.ComponentSettings.Remove.removeBySite('<?php 
    echo $site->code;
    ?>
'); return false;">
                <i class="glyphicon glyphicon-remove"></i> <?php 
    echo \Yii::t('app', 'reset settings for this site');
    ?>
            </button>
            <small><?php 
    echo \Yii::t('app', 'The settings for this component are stored in the database. This option will erase them from the database, but the component, restore the default values. As they have in the code the developer.');
    ?>
</small>
        <?php 
} else {