This method creates an instance of the calling class. It will apply the configuration
to the created instance. A matching Widget::end call should be called later.
As some widgets may use output buffering, the Widget::end call should be made in the same view
to avoid breaking the nesting of output buffers.
public static function begin($config = []) { $widget = parent::begin($config); //Когда виджет рендерится вместе с контентом то используется собственный элемент // $widget->element = '#' . $widget->options['id']; return $widget; }
public static function begin($config = []) { $defaults = ArrayHelper::remove($config, 'defaults', []); $w = parent::begin($config); $w->defaults = ArrayHelper::merge($w->defaults, $defaults); $view = $w->getView(); echo Html::beginForm($w->action, $w->method, ArrayHelper::merge(ArrayHelper::getValue($config, 'options', []), ['id' => $w->id, 'method' => 'POST', 'enctype' => 'multipart/form-data'])); KnockoutAsset::register($view); // client side validate on submit if ($w->validateOnSubmit) { $view->registerJs(sprintf(<<<EOD \$('#%1\$s').submit(function(e) { var vm = ko.dataFor(e.target); if (vm && vm.validate) { vm.validate(); } if (vm && vm.isValid && vm.isValid()) { return true; } else { e.preventDefault(); return false; } }) EOD , $w->id, Json::encode($w->defaults)), View::POS_END); } // $view->registerJs(sprintf(<<<EOD // var %1\$s = $.extend({}, x1.config, %2\$s); // EOD // , lcfirst(\yii\helpers\Inflector::camelize($w->id)), Json::encode($w->defaults))); return $w; }
/** * @inheritdoc * @throws \Exception */ public static function begin($config = []) { $tree = parent::begin($config); if (!$tree->nodes) { throw new \Exception('Node is not found'); } return $tree; }
/** * @inheritdoc */ public static function begin($config = []) { static::$raw = true; parent::begin($config); }
/** * @inherit doc */ public static function begin($config = []) { $config = self::getConfig($config); return parent::begin($config); }
public static function begin($config = []) { $tthis = parent::begin($config); echo Html::tag('header', $tthis->renderLogo() . Html::tag('ul', Html::tag('li', Html::tag('a', $tthis->options['menuLabel'] . Html::tag('span'), ['class' => 'cd-nav-trigger', 'href' => '#cd-primary-nav'])), ['class' => 'cd-header-buttons']), $tthis->options['headerOptions']), '<main class="cd-main-content">'; }
/** * @param array $config * @return ActiveForm */ public static function begin($config = []) { /** @var $widget static */ $widget = parent::begin($config); return $widget->form; }
public static function begin($config = array()) { parent::begin($config); }
public static function begin($config = []) { self::$config = ArrayHelper::merge(self::$config, $config); self::$config['id'] = uniqid('modal_'); parent::begin(); }
public static function begin($config = []) { ob_start(); return parent::begin($config); }
/** * Start widget by calling ob_start(), caching all output to output buffer * @see \yii\base\Widget::begin() */ public static function begin($config = []) { $widget = parent::begin($config); ob_start(); return $widget; }