Search by

arter / amos-tag

art-er

There is no license information available for the latest version (1.4.12) of this package.

Sistema AMOS per le TAG

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Package info

repo.aster.it/elitedivision/amos-tag

Homepage

Forum

Wiki

Type:project

pkg:composer/arter/amos-tag

Statistics

Installs: 601

Dependents: 1

Suggesters: 0

1.4.12 2022-05-04 16:00 UTC

This package is auto-updated.

Last update: 2026-10-20 03:16:35 UTC


README

Extension for tags and interest areas.

Installation

  1. The preferred way to install this extension is through composer.

Either run

composer require arter/amos-tag

or add this row

"arter/amos-tag": "dev-master"

to the require section of your composer.json file.

  1. Add module to your main config in backend:

        
     'modules' => [
         'tag' => [
             'class' => 'arter\amos\tag\AmosTag',
             'modelsEnabled' => [
                 /**
                  * Add here the classnames of the models for whose you want to enable tags
                  * (i.e. 'arter\amos\news\models\News')
                  */
             ]
         ],
     ],
    
  2. To enable user-profile interest areas (tags to match with content tags), amos-cwh installation is needed

  1. Apply migrations

    a. amos-tag migrations

     php yii migrate/up --migrationPath=@vendor/arter/amos-tag/src/migrations
    

    or add this row to your migrations config in console:

     return [
         .
         .
         .
         '@vendor/arter/amos-tag/src/migrations',
         .
         .
         .
     ];
    

Configuration

Tag management is available for admin role - url PlatformUrl /tag/manager. In tag manager it is possible to:

  • To add new trees or tags
  • enable tag trees (by root selection) for specific models - to all roles (rbac) or to the specified ones
  • change tree settings eg. root visible will allow the user to select all tags by root in TagWidget (see below)

Widgets

Amos Tag provides two Widgets:

  • TagWidget arter\amos\tag\widgets\TagWidget
    Draws tag tree to select values for a model. example of use in a form:
      echo arter\amos\tag\widgets\TagWidget::widget([
          'model' => $model,
          'attribute' => 'tagValues',
          'form' => \yii\base\Widget::$stack[0],
          'singleFixedTreeId' => $treeRoot,
          'id' => 'third-tree',
          'hideHeader' => true
      ]);
    

In a search form you can use the same widget with options :

$params = \Yii::$app->request->getQueryParams();
echo \arter\amos\tag\widgets\TagWidget::widget([
    'model' => $model,
    'attribute' => 'tagValues',
    'form' => $form,
    'isSearch' => true,
    'form_values' => isset($params[$model->formName()]['tagValues']) ? $params[$model->formName()]['tagValues'] : []
]);

If singleFixedTreeId is not specified, all enabled trees for the $model are considered (table tag_models_auth_items_mm). singleFixedTreeId is now possible an array (tag roots in singleFixedTreeId will be considered).

  • ShowTagsWidget arter\amos\tag\widgets\ShowTagsWidget
    Draws the selected tags for a model (in view mode). It is possible to specify a tree (property 'rootId') or a set of trees (property 'rootIdsArray') to show; if nothing is specified, all enabled trees for the model are considered. Example:
 <?= \arter\amos\tag\widgets\ShowTagsWidget::widget([
    'model' => $model,
    'rootId' => $rootId
 ]) ?>