public function index() { if ($tags = \Shop\Models\Products::getTags()) { sort($tags); } else { $tags = array(); } $model = (new \Shop\Models\Tags())->populateState(); $state = $model->getState(); $needle = $model->getState('filter.keyword'); if (!empty($needle)) { $tags = array_filter($tags, function ($tags) use($needle) { return stripos($tags, $needle) !== false; }); } if (!empty($tags)) { $tags = array_map(function ($el) { return new \Shop\Models\Tags(array('title' => $el)); }, $tags); } \Base::instance()->set('state', $state); \Base::instance()->set('tags', $tags); $this->app->set('meta.title', 'Tags | Shop'); $view = \Dsc\System::instance()->get('theme'); echo $view->render('Shop/Admin/Views::tags/index.php'); }
<div class="row"> <div class="col-md-2"> <h3>Tags</h3> <p class="help-block">Any products tagged with these tags will be included in the collection.</p> </div> <!-- /.col-md-2 --> <div class="col-md-10"> <div class="form-group"> <input name="tags" data-tags='<?php echo json_encode(\Shop\Models\Products::getTags()); ?> ' value="<?php echo implode(",", (array) $flash->old('tags')); ?> " type="text" class="form-control ui-select2-tags" /> </div> <!-- /.form-group --> </div> <!-- /.col-md-10 --> </div> <!-- /.row -->