Exemple #1
0
 /**
  * Динамическая отдача robots.txt
  */
 public function actionResult()
 {
     $searchQuery = \Yii::$app->cmsSearch->searchQuery;
     $this->view->title = StringHelper::ucfirst($searchQuery) . " — результаты поиска";
     return $this->render($this->action->id);
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority', 'multiple_cnt', 'version'], 'integer'], [['name', 'component'], 'required'], [['component_settings'], 'safe'], [['name', 'component', 'hint'], 'string', 'max' => 255], [['code'], 'string', 'max' => 64], [['active', 'property_type', 'list_type', 'multiple', 'with_description', 'searchable', 'filtrable', 'is_required', 'smart_filtrable'], 'string', 'max' => 1], ['code', 'default', 'value' => function ($model, $attribute) {
         return "property" . StringHelper::ucfirst(md5(rand(1, 10) . time()));
     }], ['priority', 'default', 'value' => 500], [['active', 'searchable'], 'default', 'value' => Cms::BOOL_Y], [['is_required', 'smart_filtrable', 'filtrable', 'with_description'], 'default', 'value' => Cms::BOOL_N]]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return ArrayHelper::merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority', 'multiple_cnt', 'version'], 'integer'], [['name', 'component'], 'required'], [['component_settings'], 'safe'], [['name', 'component', 'hint'], 'string', 'max' => 255], [['code'], function ($attribute) {
         if (!preg_match('/^[a-zA-Z]{1}[a-zA-Z0-9]{1,255}$/', $this->{$attribute})) {
             $this->addError($attribute, \Yii::t('skeeks/cms', 'Use only letters of the alphabet in lower or upper case and numbers, the first character of the letter (Example {code})', ['code' => 'code1']));
         }
     }], [['active', 'property_type', 'list_type', 'multiple', 'with_description', 'searchable', 'filtrable', 'is_required', 'smart_filtrable'], 'string', 'max' => 1], ['code', 'default', 'value' => function ($model, $attribute) {
         return "property" . StringHelper::ucfirst(md5(rand(1, 10) . time()));
     }], ['priority', 'default', 'value' => 500], [['active', 'searchable'], 'default', 'value' => Cms::BOOL_Y], [['is_required', 'smart_filtrable', 'filtrable', 'with_description'], 'default', 'value' => Cms::BOOL_N]]);
 }