コード例 #1
0
ファイル: Widget.php プロジェクト: gromver/yii2-platform
 public function widgetConfigControl()
 {
     ob_start();
     ob_implicit_flush(false);
     $formId = $this->getId() . '-form';
     ModalIFrame::begin(['modalOptions' => ['header' => Yii::t('gromver.platform', 'Widget "{name}" (ID: {id})', ['name' => $this->className(), 'id' => $this->id]), 'size' => Modal::SIZE_LARGE], 'buttonOptions' => ['class' => 'btn btn-default', 'tag' => 'button', 'onclick' => "jQuery('#{$formId}').submit()", 'title' => Yii::t('gromver.platform', 'Configure widget')]]);
     echo Html::beginForm(['/grom/widget/default/configure', 'modal' => 1], 'post', ['id' => $formId]);
     echo Html::hiddenInput('url', Yii::$app->request->getAbsoluteUrl());
     echo Html::hiddenInput('widget_id', $this->id);
     echo Html::hiddenInput('widget_class', $this->className());
     echo Html::hiddenInput('widget_context', $this->context);
     $objectModel = new ObjectModel($this->className());
     $objectModel->setAttributes($this->_config);
     echo Html::hiddenInput('widget_config', Json::encode($objectModel->toArray(array_keys($this->_config))));
     echo '<i class="glyphicon glyphicon-cog"></i>';
     echo Html::endForm();
     ModalIFrame::end();
     return ob_get_clean();
 }