本文整理汇总了PHP中kartik\base\Config::checkDependency方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::checkDependency方法的具体用法?PHP Config::checkDependency怎么用?PHP Config::checkDependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\base\Config
的用法示例。
在下文中一共展示了Config::checkDependency方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
$this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
if ($this->refreshGrid) {
EditableColumnAsset::register($this->_view);
}
}
示例2: init
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
\kartik\base\Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
$this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
if ($this->refreshGrid) {
EditableColumnAsset::register($this->_view);
$id = $this->grid->options['id'];
$this->_view->registerJs("kvRefreshEC('{$id}','{$this->_css}');");
}
}
示例3: init
/**
* @inherit doc
* @throw InvalidConfigException
*/
public function init()
{
if (empty($this->pluginOptions['url'])) {
throw new InvalidConfigException("The 'pluginOptions[\"url\"]' property has not been set.");
}
if (empty($this->pluginOptions['depends']) || !is_array($this->pluginOptions['depends'])) {
throw new InvalidConfigException("The 'pluginOptions[\"depends\"]' property must be set and must be an array of dependent dropdown element ID.");
}
if (empty($this->options['class'])) {
$this->options['class'] = 'form-control';
}
if ($this->type === self::TYPE_SELECT2) {
Config::checkDependency('select2\\Select2', 'yii2-widget-select2', 'for dependent dropdown for TYPE_SELECT2');
}
parent::init();
if ($this->type !== self::TYPE_SELECT2 && !empty($this->options['placeholder'])) {
$this->data = ['' => $this->options['placeholder']] + $this->data;
}
if ($this->type === self::TYPE_SELECT2 && (!empty($this->options['placeholder']) || !empty($this->select2Options['options']['placeholder']))) {
$this->pluginOptions['placeholder'] = '';
} elseif ($this->type === self::TYPE_SELECT2 && !empty($this->pluginOptions['placeholder']) && $this->pluginOptions['placeholder'] !== false) {
$this->options['placeholder'] = $this->pluginOptions['placeholder'];
$this->pluginOptions['placeholder'] = '';
}
$this->_view = $this->getView();
$this->registerAssets();
if ($this->type === self::TYPE_SELECT2) {
if (empty($this->data)) {
$this->data = ['' => ''];
}
if ($this->hasModel()) {
$settings = ArrayHelper::merge($this->select2Options, ['model' => $this->model, 'attribute' => $this->attribute, 'data' => $this->data, 'options' => $this->options]);
} else {
$settings = ArrayHelper::merge($this->select2Options, ['name' => $this->name, 'value' => $this->value, 'data' => $this->data, 'options' => $this->options]);
}
echo Select2::widget($settings);
$id = 'jQuery("#' . $this->options['id'] . '")';
$text = ArrayHelper::getValue($this->pluginOptions, 'loadingText', 'Loading ...');
$this->_view->registerJs("{$id}.on('depdrop.beforeChange',function(e,i,v){{$id}.select2('data',{text: '{$text}'});});");
$this->_view->registerJs("{$id}.on('depdrop.change',function(e,i,v,c){{$id}.select2('val',{$id}.val());});");
} else {
echo $this->getInput(!empty($this->typename) ? $this->typename : 'dropdownList', true);
}
}
示例4: run
/**
* Runs the widget
*
* @throws InvalidConfigException
*/
public function run()
{
if (empty($this->pluginOptions['url'])) {
throw new InvalidConfigException("The 'pluginOptions[\"url\"]' property has not been set.");
}
if (empty($this->pluginOptions['depends']) || !is_array($this->pluginOptions['depends'])) {
throw new InvalidConfigException("The 'pluginOptions[\"depends\"]' property must be set and must be an array of dependent dropdown element identifiers.");
}
if (empty($this->options['class'])) {
$this->options['class'] = 'form-control';
}
if ($this->type === self::TYPE_SELECT2) {
Config::checkDependency('select2\\Select2', 'yii2-widget-select2', 'for dependent dropdown for Select2');
}
if ($this->type !== self::TYPE_SELECT2 && !empty($this->options['placeholder'])) {
$this->data = ['' => $this->options['placeholder']] + $this->data;
}
$this->registerAssets();
}
示例5: init
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
\kartik\base\Config::checkDependency('editable\\Editable', 'yii2-editable', 'for GridView EditableColumn');
$this->_css = 'kv-edcol-' . hash('crc32', uniqid(rand(1, 100), true));
}
示例6: run
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function run()
{
$this->initToggleData();
$this->initExport();
if ($this->export !== false && isset($this->exportConfig[self::PDF])) {
\kartik\base\Config::checkDependency('mpdf\\Pdf', 'yii2-mpdf', "for PDF export functionality. To include PDF export, follow the install steps below. If you do not " . "need PDF export functionality, do not include 'PDF' as a format in the 'export' property. You can " . "otherwise set 'export' to 'false' to disable all export functionality");
}
$this->initHeader();
$this->initBootstrapStyle();
$this->containerOptions['id'] = $this->options['id'] . '-container';
Html::addCssClass($this->containerOptions, 'kv-grid-container');
$this->registerAssets();
$this->renderPanel();
$this->initLayout();
$this->beginPjax();
parent::run();
$this->endPjax();
}
示例7: validateSettings
public function validateSettings()
{
if (!$this->hasModel() && ($this->name1 === null || $this->name2 === null)) {
throw new InvalidConfigException("Either 'name1','name2' or 'attribute1', 'attribute2' with 'model' properties must be specified.");
}
if (!$this->_isInput && $this->type !== self::INPUT_WIDGET && !in_array($this->type, self::$_inputWidgets)) {
throw new InvalidConfigException("Invalid value for 'type'. Must be one of the FieldRange::INPUT constants.");
}
if (isset($this->form) && $this->useAddons && !$this->form instanceof ActiveForm) {
Config::checkDependency('form\\ActiveForm', ['yii2-widget-activeform', 'yii2-widgets'], "when 'useAddons' is set to true.");
throw new InvalidConfigException("The 'form' property must be an instance of '\\kartik\\form\\ActiveForm' or '\\kartik\\widgets\\ActiveForm' when 'useAddons' is set to true.");
}
if (isset($this->form) && !$this->useAddons && !$this->form instanceof \yii\widgets\ActiveForm) {
throw new InvalidConfigException("The 'form' property must be an instance of '\\yii\\widgets\\ActiveForm'.");
}
if (isset($this->form) && !$this->hasModel()) {
throw new InvalidConfigException("The 'model' and 'attribute1', 'attribute2' property must be set when 'form' is set.");
}
if ($this->type === self::INPUT_WIDGET && empty($this->widgetClass)) {
throw new InvalidConfigException("The 'widgetClass' property must be set for widget input type.");
}
}
示例8: init
/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
\kartik\base\Config::checkDependency('editable\Editable', 'yii2-editable', 'for GridView EditableColumn');
}
示例9: initOptions
/**
* Initializes options and settings
* @throws InvalidConfigException
*/
protected function initOptions()
{
if ($this->type == self::TYPE_GROWL) {
Config::checkDependency('growl\\Growl', 'yii2-widget-growl', 'for rendering Growl notifications in the alert block');
}
if (empty($this->options['id'])) {
$this->options['id'] = $this->getId();
}
if (!isset($this->delay)) {
$this->delay = $this->type == self::TYPE_ALERT ? 2000 : 1200;
}
if (empty($this->alertSettings) && $this->type == self::TYPE_GROWL) {
$this->alertSettings = ['error' => ['type' => Growl::TYPE_DANGER], 'success' => ['type' => Growl::TYPE_SUCCESS], 'info' => ['type' => Growl::TYPE_INFO], 'warning' => ['type' => Growl::TYPE_WARNING], 'growl' => ['type' => Growl::TYPE_GROWL]];
} elseif (empty($this->alertSettings)) {
$this->alertSettings = ['error' => ['type' => Alert::TYPE_DANGER], 'success' => ['type' => Alert::TYPE_SUCCESS], 'info' => ['type' => Alert::TYPE_INFO], 'warning' => ['type' => Alert::TYPE_WARNING], 'primary' => ['type' => Alert::TYPE_PRIMARY], 'default' => ['type' => Alert::TYPE_DEFAULT]];
}
}