當前位置: 首頁>>代碼示例>>PHP>>正文


PHP behaviors\SluggableBehavior類代碼示例

本文整理匯總了PHP中yii\behaviors\SluggableBehavior的典型用法代碼示例。如果您正苦於以下問題:PHP SluggableBehavior類的具體用法?PHP SluggableBehavior怎麽用?PHP SluggableBehavior使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SluggableBehavior類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: behaviors

 public function behaviors()
 {
     return [['class' => SluggableBehavior::className(), 'attribute' => 'nombre', 'immutable' => true, 'ensureUnique' => true], 'sitemap' => ['class' => SitemapBehavior::className(), 'scope' => function ($model) {
         /** @var \yii\db\ActiveQuery $model */
         $model->select(['municipios.slug']);
     }, 'dataClosure' => function ($model) {
         /** @var self $model */
         return ['loc' => Url::to($model->slug, true), 'changefreq' => SitemapBehavior::CHANGEFREQ_NEVER, 'priority' => 0.5];
     }]];
 }
開發者ID:alejandrososa,項目名稱:AB,代碼行數:10,代碼來源:Municipios.php

示例2: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['timestamp' => TimestampBehavior::className(), 'sluggable' => ['class' => SluggableBehavior::className(), 'attribute' => 'name'], 'tree' => ['class' => NestedSetsBehavior::className(), 'treeAttribute' => 'tree'], 'files' => ['class' => FilesBehavior::className(), 'attributes' => ['uploadedImage' => ['filesystem' => 'local', 'path' => '/categories', 'fileName' => '{model.slug}.{file.extension}', 'relation' => 'image', 'deleteOnUnlink' => true, 'on beforeSave' => function (FileInterface $file) {
         $image = ImageManagerStatic::make($file->getPath());
         $image->resize(400, null, function (Constraint $constraint) {
             $constraint->aspectRatio();
             $constraint->upsize();
         });
         $image->save($file->getPath(), 100);
     }]]], 'relations' => ['class' => RelationsBehavior::className(), 'settings' => ['image' => ['deleteOnUnlink' => true]], 'relations' => ['imageRelation' => $this->hasOne(CategoryFile::className(), ['id' => 'image_id'])]]];
 }
開發者ID:manyoubaby123,項目名稱:imshop,代碼行數:14,代碼來源:Category.php

示例3: behaviors

 public function behaviors()
 {
     $behaviors = ['sluggable' => ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'ensureUnique' => true, "immutable" => true], SetMaxSortableModel::className()];
     $behaviors['timestamp'] = TimestampBehavior::className();
     $behaviors['published_at'] = ['class' => \hass\base\behaviors\StrToTimeBehavior::className(), "attribute" => "published_at"];
     $behaviors["meta"] = MetaBehavior::className();
     $behaviors["thumbnailFile"] = ['class' => \hass\attachment\behaviors\UploadBehavior::className(), 'attribute' => 'thumbnail'];
     $behaviors["textEditor"] = ['class' => \hass\base\misc\editor\EditorBehavior::className(), 'attribute' => 'content'];
     $behaviors["TimestampFormatter"] = TimestampFormatter::className();
     $behaviors["commentEnabled"] = ['class' => CommentBehavior::className(), 'defaultStatus' => CommentEnabledEnum::STATUS_ON];
     return $behaviors;
 }
開發者ID:hassiumsoft,項目名稱:hasscms-packages,代碼行數:12,代碼來源:Page.php

示例4: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['sluggable' => ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'ensureUnique' => true], 'timestamp' => TimestampBehavior::className(), 'files' => ['class' => FilesBehavior::className(), 'attributes' => ['uploadedImages' => ['filesystem' => 'local', 'path' => '/products/{model.id}', 'fileName' => '{model.slug}.{file.extension}', 'multiple' => true, 'relation' => 'images', 'on beforeSave' => function (FileInterface $file) {
         $image = ImageManagerStatic::make($file->getPath());
         $image->resize(1000, null, function (Constraint $constraint) {
             $constraint->aspectRatio();
             $constraint->upsize();
         });
         $image->save($file->getPath(), 100);
     }, 'on afterDeleteAll' => function (StorageConfig $config, FilesystemComponent $filesystemComponent) {
         $path = $config->resolvePath($this);
         $filesystemComponent->deleteDirectory($path, $config->filesystem);
     }]]], 'relations' => ['class' => RelationsBehavior::className(), 'settings' => ['relatedEAttributes' => ['deleteOnUnlink' => true], 'images' => ['deleteOnUnlink' => true, 'extraColumns' => ['attribute' => 'images']]], 'relations' => ['imagesRelation' => $this->hasMany(ProductFile::className(), ['product_id' => 'id'])->where(['attribute' => 'images'])]]];
 }
開發者ID:xyxdasnjss,項目名稱:imshop,代碼行數:17,代碼來源:Product.php

示例5: behaviors

 public function behaviors()
 {
     $behaviors = ['sluggable' => ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'ensureUnique' => true, "immutable" => true]];
     $behaviors['author_id'] = ['class' => BlameableBehavior::className(), 'attributes' => [static::EVENT_BEFORE_INSERT => 'author_id']];
     $behaviors['timestamp'] = TimestampBehavior::className();
     $behaviors['published_at'] = ['class' => StrToTimeBehavior::className(), 'attribute' => 'published_at'];
     $behaviors['taggabble'] = Taggable::className();
     $behaviors['meta'] = MetaBehavior::className();
     $behaviors['thumbnailFile'] = ['class' => \hass\attachment\behaviors\UploadBehavior::className(), 'attribute' => 'thumbnail'];
     $behaviors['taxonomy'] = ['class' => TaxonomyBehavior::className()];
     $behaviors['textEditor'] = ['class' => \hass\base\misc\editor\EditorBehavior::className(), 'attribute' => 'content'];
     $behaviors['TimestampFormatter'] = TimestampFormatter::className();
     $behaviors['commentEnabled'] = ['class' => CommentBehavior::className(), 'defaultStatus' => CommentEnabledEnum::STATUS_ON];
     return $behaviors;
 }
開發者ID:rocketyang,項目名稱:hasscms-app,代碼行數:15,代碼來源:Post.php

示例6: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [BlameableBehavior::className(), TimestampBehavior::className(), 'sluggable' => ['class' => SluggableBehavior::className(), 'attribute' => 'title'], 'multilingual' => ['class' => MultilingualBehavior::className(), 'langForeignKey' => 'media_album_id', 'tableName' => "{{%media_album_lang}}", 'attributes' => ['title', 'description']]];
 }
開發者ID:yeesoft,項目名稱:yii2-yee-media,代碼行數:7,代碼來源:Album.php

示例7: behaviors

 public function behaviors()
 {
     return [['class' => TimestampBehavior::className()], ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'immutable' => true, 'ensureUnique' => true], ['class' => FileBehavior::className(), 'attribute' => 'image']];
 }
開發者ID:promo-pr,項目名稱:cms,代碼行數:4,代碼來源:Page.php

示例8: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'author_id', 'updatedByAttribute' => 'updater_id'], ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'immutable' => true], ['class' => UploadBehavior::className(), 'attribute' => 'attachments', 'multiple' => true, 'uploadRelation' => 'financeAttachments'], ['class' => UploadBehavior::className(), 'attribute' => 'thumbnail', 'pathAttribute' => 'thumbnail_path', 'baseUrlAttribute' => 'thumbnail_base_url'], ['class' => ChangeLogBehavior::className()]];
 }
開發者ID:allhaze,項目名稱:renault,代碼行數:7,代碼來源:Finance.php

示例9: behaviors

 public function behaviors()
 {
     return [['class' => SluggableBehavior::className(), 'attribute' => 'name'], 'timestamp' => ['class' => TimestampBehavior::className()], ['class' => BlameableBehavior::className()]];
 }
開發者ID:eltortuganegra,項目名稱:heavyCMS,代碼行數:4,代碼來源:BlogCategoryLang.php

示例10: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['authorBehavior' => ['class' => AuthorBehavior::className()], 'sluggableBehavior' => ['class' => SluggableBehavior::className(), 'attribute' => 'name', 'slugAttribute' => 'slug', 'ensureUnique' => true], 'timestampBehavior' => ['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'createdAt', 'updatedAtAttribute' => 'modifiedAt', 'value' => new Expression('NOW()')]];
 }
開發者ID:cmsgears,項目名稱:module-core,代碼行數:7,代碼來源:Role.php

示例11: behaviors

 public function behaviors()
 {
     return ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']], 'value' => new Expression('NOW()')], 'blameable' => ['class' => \yii\behaviors\BlameableBehavior::className(), 'createdByAttribute' => 'created_by', 'updatedByAttribute' => 'updated_by'], ['class' => SluggableBehavior::className(), 'attribute' => 'titulo', 'slugAttribute' => 'seo_slug']];
 }
開發者ID:nando9,項目名稱:yii2capa8,代碼行數:4,代碼來源:Noticia.php

示例12: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [BlameableBehavior::className(), TimestampBehavior::className(), ['class' => SluggableBehavior::className(), 'attribute' => 'name', 'ensureUnique' => true], 'builderField' => ['class' => JsonToArrayBehavior::className(), 'jsonFieldName' => 'builder']];
 }
開發者ID:ramialcheikh,項目名稱:quickforms,代碼行數:7,代碼來源:Template.php

示例13: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['tree' => ['class' => NestedSetsBehavior::className(), 'treeAttribute' => 'tree'], ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'slugAttribute' => 'alias', 'immutable' => true]];
 }
開發者ID:bitxseven,項目名稱:yii2-big,代碼行數:7,代碼來源:Menu.php

示例14: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [['class' => SluggableBehavior::className(), 'attribute' => 'post_title', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['post_slug']]]];
 }
開發者ID:pramana08,項目名稱:app-cms,代碼行數:7,代碼來源:Post.php

示例15: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [['class' => SluggableBehavior::className(), 'attribute' => 'slug', 'slugAttribute' => 'slug', 'ensureUnique' => true], ['class' => TimestampBehavior::className()], ['class' => BlameableBehavior::className()]];
 }
開發者ID:nguyentuansieu,項目名稱:phutungoto,代碼行數:7,代碼來源:Page.php


注:本文中的yii\behaviors\SluggableBehavior類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。