behaviors\SluggableBehavior validateSlug()

validateSlug() protected method Checks if given slug value is unique. protected boolean validateSlug ( $slug )$slug string Slug value return boolean Whether slug is unique.

behaviors\SluggableBehavior makeUnique()

makeUnique() protected method (available since version 2.0.7) This method is called by getValue() when $ensureUnique is true to generate the unique slug. Calls generateUniqueSlug() until generated slug is unique and returns it. See also: getValue() generateUniqueSlug() protected string makeUnique ( $slug )$slug string Basic slug value return string Unique slug

behaviors\SluggableBehavior isNewSlugNeeded()

isNewSlugNeeded() protected method (available since version 2.0.7) Checks whether the new slug generation is needed This method is called by getValue() to check whether the new slug generation is needed. You may override it to customize checking. protected boolean isNewSlugNeeded ( )

behaviors\SluggableBehavior init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

behaviors\SluggableBehavior getValue()

getValue() protected method Returns the value for the current attributes. This method is called by evaluateAttributes(). Its return value will be assigned to the attributes corresponding to the triggering event. protected mixed getValue ( $event )$event yii\base\Event The event that triggers the current attribute updating. return mixed The attribute value

behaviors\SluggableBehavior generateUniqueSlug()

generateUniqueSlug() protected method Generates slug using configured callback or increment of iteration. protected string generateUniqueSlug ( $baseSlug, $iteration )$baseSlug string Base slug value $iteration integer Iteration number return string New slug value throws yii\base\InvalidConfigException

behaviors\SluggableBehavior generateSlug()

generateSlug() protected method This method is called by getValue() to generate the slug. You may override it to customize slug generation. The default implementation calls yii\helpers\Inflector::slug() on the input strings concatenated by dashes (-). protected string generateSlug ( $slugParts )$slugParts array An array of strings that should be concatenated and converted to generate the slug value. return string The conversion result.

behaviors\SluggableBehavior $value

$value public property The value that will be used as a slug. This can be an anonymous function or an arbitrary value. If the former, the return value of the function will be used as a slug. The signature of the function should be as follows, function ($event) { // return slug } public string|callable $value = null

behaviors\SluggableBehavior $uniqueValidator

$uniqueValidator public property Configuration for slug uniqueness validator. Parameter 'class' may be omitted - by default yii\validators\UniqueValidator will be used. See also yii\validators\UniqueValidator. public array $uniqueValidator = []

behaviors\SluggableBehavior $uniqueSlugGenerator

$uniqueSlugGenerator public property Slug unique value generator. It is used in case $ensureUnique enabled and generated slug is not unique. This should be a PHP callable with following signature: function ($baseSlug, $iteration, $model) { // return uniqueSlug } If not set unique slug will be generated adding incrementing suffix to the base slug. public callable $uniqueSlugGenerator = null