/** * Инициализация кнопки * @param \frontend\models\Market $market * @return string|void */ public function initBuy(\frontend\models\Market $market = null) { if ($market && isset($market->settings)) { $settings = json_decode($market->settings, true); } else { $settings = array(); } $xml_structure = $this->getStructure(); $html = \yii\bootstrap\Html::beginForm('?r=payqr/button/create' . (isset($market->id) ? "&market_id=" . $market->id : ""), 'post', []); $html .= \yii\bootstrap\Html::csrfMetaTags(); //инициализируем общие настройки кнопки foreach ($xml_structure as $row) { if (isset($row['field'][0]['@attributes']['value']) && !$this->buttonStructure($row)) { $html .= $this->generateHtml($row, $settings); } } //инициализиурем параметры кнопки в соответствии с местом отображения foreach ($this->ShowInPlace as $place => $placeTranslate) { foreach ($this->buttonXmlStructure as $xmlrow) { $html .= $this->generateHtml($xmlrow, $settings, array(0 => $place, 1 => $placeTranslate)); } } $html .= \yii\bootstrap\Html::submitButton('Сохранить'); $html .= \yii\bootstrap\Html::endForm(); return $html; }
<?php $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php echo Html::csrfMetaTags(); ?> <title><?php echo Html::encode($this->title); ?> </title> <?php $this->head(); ?> </head> <body> <?php $this->beginBody(); echo $this->render('/shared/nav'); ?> <div class="wrapper">