Author: Alexander Kochetov (creocoder@gmail.com)
Inheritance: extends yii\base\Behavior
コード例 #1
0
 /**
  * @inherited
  */
 public function hasTranslation($language = null)
 {
     if ($language === null) {
         $language = Lang::getCurrent()->id;
     }
     return parent::hasTranslation($language);
 }
コード例 #2
0
ファイル: Article.php プロジェクト: tolik505/bl
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['translateable' => ['class' => \creocoder\translateable\TranslateableBehavior::className(), 'translationAttributes' => static::getTranslationAttributes()], 'timestamp' => ['class' => \yii\behaviors\TimestampBehavior::className()], 'sitemap' => ['class' => SitemapBehavior::className(), 'scope' => function ($model) {
         /** @var \yii\db\ActiveQuery $model */
         $model->andWhere(['published' => 1]);
     }, 'dataClosure' => function ($model) {
         /** @var self $model */
         return ['loc' => Url::to($model->getViewUrl(), true), 'lastmod' => $model->updated_at, 'changefreq' => SitemapBehavior::CHANGEFREQ_WEEKLY, 'priority' => 0.8];
     }]]);
 }
コード例 #3
0
ファイル: Post.php プロジェクト: creocoder/yii2-translateable
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['title', 'body']]];
 }
コード例 #4
0
 public function behaviors()
 {
     return ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['name', 'params']], 'timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }]];
 }
コード例 #5
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['to', 'bcc', 'from', 'subject', 'message']], 'timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }]]);
 }
コード例 #6
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }], 'translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['alt', 'title', 'subtitle', 'description', 'link']]]);
 }
コード例 #7
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['name', 'description', 'slug']], 'timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }], 'image' => ['class' => 'infoweb\\cms\\behaviors\\ImageBehave'], 'sortable' => ['class' => Sortable::className(), 'orderAttribute' => ['position']]];
 }
コード例 #8
0
ファイル: Configuration.php プロジェクト: tolik505/bl
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['translateable' => ['class' => \creocoder\translateable\TranslateableBehavior::className(), 'translationAttributes' => static::getTranslationAttributes()], 'timestamp' => ['class' => \yii\behaviors\TimestampBehavior::className()]]);
 }
コード例 #9
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['name', 'title', 'content']], 'timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }], 'homepage' => ['class' => HomepageBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => 'homepage', ActiveRecord::EVENT_BEFORE_UPDATE => 'homepage']], 'seo' => ['class' => SeoBehavior::className(), 'titleAttribute' => 'title'], 'image' => ['class' => 'infoweb\\cms\\behaviors\\ImageBehave']]);
 }
コード例 #10
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']]], 'translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['name', 'content']]];
 }