当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::buildTextTree方法代码示例

本文整理汇总了PHP中app\modules\shop\models\Category::buildTextTree方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::buildTextTree方法的具体用法?PHP Category::buildTextTree怎么用?PHP Category::buildTextTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\modules\shop\models\Category的用法示例。


在下文中一共展示了Category::buildTextTree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

><a href="<?php 
echo Url::toRoute(['category/index', 'view' => 'tree']);
?>
">Деревом</a></li>
        <li role="presentation" <?php 
if (yii::$app->request->get('view') == 'list') {
    echo ' class="active"';
}
?>
><a href="<?php 
echo Url::toRoute(['category/index', 'view' => 'list']);
?>
">Списком</a></li>
    </ul>

    <br style="clear: both;">
    <?php 
if (isset($_GET['view']) && $_GET['view'] == 'list') {
    $categories = \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id', 'filter' => false, 'options' => ['style' => 'width: 55px;']], 'name', ['attribute' => 'image', 'format' => 'image', 'filter' => false, 'content' => function ($image) {
        if ($image = $image->getImage()->getUrl('50x50')) {
            return "<img src=\"{$image}\" class=\"thumb\" />";
        }
    }], ['attribute' => 'parent_id', 'filter' => Html::activeDropDownList($searchModel, 'parent_id', Category::buildTextTree(), ['class' => 'form-control', 'prompt' => 'Категория']), 'value' => 'parent.name'], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn']]]);
} else {
    $categories = \app\modules\tree\widgets\Tree::widget(['model' => new \app\modules\shop\models\Category()]);
}
echo $categories;
?>

</div>
开发者ID:oakcms,项目名称:oakcms,代码行数:30,代码来源:index.php

示例2:




    <div class="row">
        <div class="col-lg-6 col-xs-6">
            <?php 
echo $form->field($model, 'category_id')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите категорию ...'], 'pluginOptions' => ['allowClear' => true]]);
?>

            <?php 
echo $form->field($model, 'producer_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Producer::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите бренд ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-lg-6 col-xs-6">
            <?php 
echo $form->field($model, 'category_ids')->label('Прочие категории')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['multiple' => true, 'placeholder' => 'Доп. категории ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
    </div>

    <?php 
echo $form->field($model, 'text')->widget(\app\widgets\Editor::className());
?>

    <?php 
echo $form->field($model, 'short_text')->textInput(['maxlength' => true]);
?>

    <?php 
echo Gallery::widget(['model' => $model]);
?>
开发者ID:oakcms,项目名称:oakcms,代码行数:28,代码来源:_form.php


注:本文中的app\modules\shop\models\Category::buildTextTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。