skeeks\cms\models\CmsComponentSettings::fetchByComponentSiteCode PHP Method

fetchByComponentSiteCode() public static method

Получение настроек для компонента по коду сайта.
public static fetchByComponentSiteCode ( Component $component, string $site_code ) : static
$component skeeks\cms\base\Component компонент с настройками
$site_code string код сайта
return static
    public static function fetchByComponentSiteCode($component, $site_code)
    {
        return static::baseQuery($component)->andWhere(['site_code' => (string) $site_code])->one();
    }

Usage Example

 /**
  * @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);
 }
All Usage Examples Of skeeks\cms\models\CmsComponentSettings::fetchByComponentSiteCode