本文整理匯總了PHP中app\models\Currency::labels方法的典型用法代碼示例。如果您正苦於以下問題:PHP Currency::labels方法的具體用法?PHP Currency::labels怎麽用?PHP Currency::labels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Currency
的用法示例。
在下文中一共展示了Currency::labels方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Category;
use app\models\Supplier;
use app\models\Product;
use app\models\Currency;
use yii\helpers\ArrayHelper;
use zxbodya\yii2\galleryManager\GalleryManager;
/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $form yii\widgets\ActiveForm */
$categories = Category::find()->active()->orderBy(['title' => SORT_ASC])->all();
$suppliers = Supplier::find()->active()->orderBy(['name' => SORT_ASC])->all();
$currencies = Currency::labels();
?>
<div class="product-form">
<?php
$form = ActiveForm::begin(['enableClientValidation' => false, 'options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map($categories, 'id', 'title'));
?>
<?php
echo $form->field($model, 'supplier_id')->dropDownList(ArrayHelper::map($suppliers, 'id', 'name'));
?>
示例2: getVariantCurrencyLabel
/**
* Get the variant currency label.
* @return string
*/
public function getVariantCurrencyLabel()
{
return Currency::labels()[$this->variant_currency];
}