/**
  * @inheritdoc
  * @return array
  */
 public function actions()
 {
     return ['getTree' => ['class' => AdjacencyFullTreeDataAction::className(), 'class_name' => Category::className(), 'model_label_attribute' => 'name'], 'getCatTree' => ['class' => 'app\\backend\\actions\\JSSelectableTreeGetTree', 'modelName' => 'app\\modules\\shop\\models\\Category', 'label_attribute' => 'name', 'vary_by_type_attribute' => null], 'addImage' => ['class' => AddImageAction::className()], 'upload' => ['class' => UploadAction::className(), 'upload' => 'theme/resources/product-images'], 'remove' => ['class' => RemoveAction::className(), 'uploadDir' => 'theme/resources/product-images'], 'save-info' => ['class' => SaveInfoAction::className()], 'update-editable' => ['class' => UpdateEditable::className(), 'modelName' => Product::className(), 'allowedAttributes' => ['currency_id' => function (Product $model, $attribute) {
         if ($model === null || $model->currency === null || $model->currency_id === 0) {
             return null;
         }
         return \yii\helpers\Html::tag('div', $model->currency->name, ['class' => $model->currency->name]);
     }, 'price', 'old_price', 'active' => function (Product $model) {
         if ($model === null || $model->active === null) {
             return null;
         }
         if ($model->active === 1) {
             $label_class = 'label-success';
             $value = 'Active';
         } else {
             $value = 'Inactive';
             $label_class = 'label-default';
         }
         return \yii\helpers\Html::tag('span', Yii::t('app', $value), ['class' => "label {$label_class}"]);
     }]], 'property-handler' => ['class' => PropertyHandler::className(), 'modelName' => Product::className()]];
 }
Пример #2
0
 public function actions()
 {
     return ['getTree' => ['class' => AdjacencyFullTreeDataAction::className(), 'class_name' => Page::className(), 'model_label_attribute' => 'name'], 'upload' => ['class' => UploadAction::className(), 'upload' => 'theme/resources/product-images'], 'remove' => ['class' => RemoveAction::className(), 'uploadDir' => 'theme/resources/product-images'], 'save-info' => ['class' => SaveInfoAction::className()], 'property-handler' => ['class' => PropertyHandler::className(), 'modelName' => Page::className()], 'move' => ['class' => TreeNodeMoveAction::className(), 'className' => Page::className(), 'saveAttributes' => ['slug_compiled']], 'reorder' => ['class' => TreeNodesReorderAction::className(), 'className' => Page::className()]];
 }