Download the PHP package kit-tools/yii2-tags without Composer
On this page you can find all versions of the php package kit-tools/yii2-tags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-tags
Yii2-tags behavior
The extension allows you to add tags to different models. Counts the weight of tags and the number of clicks per tag for each model. There is also an admin panel for adding tags. And a few widgets to display tags.
Installation
The preferred way to install this extension is through composer.
Either run:
or add
to the require section of your composer.json file.
Usage
Admin
Add to config (config/main.php или config/web.php)
Property $tagList
In the model with which you want to associate tags, add:
Validation rules
If the tags are optional, then you need to delete the line
Behavior
TagBehavior works with events:
- ActiveRecord :: EVENT_AFTER_INSERT, ActiveRecord :: EVENT_AFTER_UPDATE - adds new tags, establishes / removes model and tag relationships.
- ActiveRecord :: EVENT_AFTER_DELETE - when deleting a model, removes links with tags. Linked tags are not removed.
Important!!! If there are connected tags in the model, and the tags will not be transferred when saving, then all links with the tags will be deleted! To avoid this situation, before saving the model, you need to untie the TagBehavior
One-to-many relationship
The method adds a model link to odic-to-many tags through an intermediate table.
Form adding tags in creating / editing models
Add tag widget
The widget loads the tags with an ajax request. Minimum word length after which tags will be loaded, 2 characters.
or
The widget does not load tags through an ajax request. A list of tags is loaded when the page loads.
Tag widget inherited from kartik\select2\Select2.
More information about widget settings can be found at https://select2.org/
Tag output widget
When using the widget in the list of materials, do not forget about the "problem of N + 1 queries".
Detailed description of widget settings in a file
Tag cloud widget
more information about widget settings can be found in