本文整理汇总了PHP中kartik\base\Config::initModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::initModule方法的具体用法?PHP Config::initModule怎么用?PHP Config::initModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\base\Config
的用法示例。
在下文中一共展示了Config::initModule方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert
/**
* Converts markdown into HTML
*
* @param string $content
* @param array $config . Options to configure MarkdownExtra and smarty
* - markdown: array for MarkdownExtra configuration parameters
* - smarty: array for SmartyPantsTypographer configuration parameters
* - custom: array for Custom configuration parameters
* @param int $smartyMode the SmartyPantsTypographer processing mode
*
* @return string
* @throws InvalidConfigException if module not set
*/
public static function convert($content, $config = [], $smartyMode = self::SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN)
{
$module = Config::initModule(Module::classname());
$output = $content;
if (strlen($output) > 0) {
$mdConfig = empty($config['markdown']) ? [] : $config['markdown'];
$output = static::process($content, $mdConfig);
if ($module->smartyPants) {
$smConfig = empty($config['smarty']) ? [] : $config['smarty'];
$smarty = new SmartyPants($smartyMode);
foreach ($smConfig as $name => $value) {
$smarty->{$name} = $value;
}
$output = $smarty->transform($output);
$cuConfig = empty($config['custom']) ? $module->customConversion : $config['custom'];
$output = static::customProcess($output, $cuConfig);
}
if (is_bool($module->smarty) && $module->smarty || (is_string($module->smarty) || is_callable($module->smarty)) && call_user_func($module->smarty, $module)) {
$smarty = new \Smarty();
if ($module->smartyYiiApp) {
$smarty->assign('app', Yii::$app);
}
if ($module->smartyYiiParams) {
$smarty->config_vars = Yii::$app->params;
}
$output = $smarty->fetch('string:' . $output, null, null, $module->smartyParams);
}
}
return $output;
}
示例2: init
/**
* Initializes the object
*
* @throws InvalidConfigException
*/
public function init()
{
$this->_module = Config::initModule(Module::classname());
$this->_isMaster = $this->category == self::STORE_GRID ? true : false;
if ($this->_module == null || !$this->_module instanceof Module) {
throw new InvalidConfigException('The "dynagrid" module MUST be setup in your Yii configuration file and assigned to "\\kartik\\dynagrid\\Module" class.');
}
if (!isset($this->id)) {
throw new InvalidConfigException('The dynagrid "id" property must be entered.');
}
$this->setKey();
}
示例3: convert
/**
* Converts markdown into HTML
*
* @param string $content
* @param array $config . Options to configure MarkdownExtra and smarty
* - markdown: array for MarkdownExtra configuration parameters
* - smarty: array for SmartyPantsTypographer configuration parameters
* - custom: array for Custom configuration parameters
* @param int $smartyMode the SmartyPantsTypographer processing mode
*
* @return string
* @throws InvalidConfigException if module not set
*/
public static function convert($content, $config = [], $smartyMode = self::SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN)
{
$module = Config::initModule(Module::classname());
$output = $content;
if (strlen($output) > 0) {
$mdConfig = empty($config['markdown']) ? [] : $config['markdown'];
$output = static::process($content, $mdConfig);
if ($module->smartyPants) {
$smConfig = empty($config['smarty']) ? [] : $config['smarty'];
$smarty = new SmartyPantsTypographer($smartyMode);
foreach ($smConfig as $name => $value) {
$smarty->{$name} = $value;
}
$output = $smarty->transform($output);
$cuConfig = empty($config['custom']) ? $module->customConversion : $config['custom'];
$output = static::customProcess($output, $cuConfig);
}
}
return $output;
}
示例4: init
/**
* Initializes the widget
*
* @throws InvalidConfigException
* @return void
*/
public function init()
{
parent::init();
if (empty($this->options['id'])) {
throw new InvalidConfigException("You must setup a unique identifier for DynaGrid within \"options['id']\".");
}
$this->_module = Config::initModule(Module::classname());
$this->_gridModalId = $this->options['id'] . '-grid-modal';
$this->_filterModalId = $this->options['id'] . '-filter-modal';
$this->_sortModalId = $this->options['id'] . '-sort-modal';
$this->_filterKey = $this->options['id'] . '-filter-key';
$this->_sortKey = $this->options['id'] . '-sort-key';
$this->_pjaxId = $this->options['id'] . '-pjax';
foreach ($this->_module->dynaGridOptions as $key => $setting) {
if (is_array($setting) && !empty($setting) && !empty($this->{$key})) {
$this->{$key} = ArrayHelper::merge($setting, $this->{$key});
} elseif (!isset($this->{$key})) {
$this->{$key} = $setting;
}
}
if (empty($this->columns) || !is_array($this->columns)) {
throw new InvalidConfigException("The 'columns' configuration must be setup as a valid array.");
}
if (empty($this->gridOptions['dataProvider']) && empty($this->gridOptions['filterModel'])) {
throw new InvalidConfigException("You must setup either the gridOptions['filterModel'] or gridOptions['dataProvider'].");
}
if (!empty($this->gridOptions['filterModel']) && !method_exists($this->gridOptions['filterModel'], 'search')) {
throw new InvalidConfigException("The gridOptions['filterModel'] must implement a 'search' method in order to apply saved filters.");
}
if (empty($this->gridOptions['dataProvider'])) {
$this->initDataProvider($this->gridOptions['filterModel']);
}
if (empty($this->gridOptions['filterModel'])) {
$this->showFilter = false;
$this->allowFilterSetting = false;
}
if (empty($this->theme)) {
$this->theme = $this->_module->defaultTheme;
}
if (empty($this->_pageSize)) {
$this->_pageSize = $this->_module->defaultPageSize;
}
$this->_requestSubmit = $this->options['id'] . '-dynagrid';
$this->_model = new DynaGridConfig();
$this->_isSubmit = !empty($_POST[$this->_requestSubmit]) && $this->_model->load(Yii::$app->request->post()) && $this->_model->validate();
$this->_store = new DynaGridStore(['id' => $this->options['id'], 'storage' => $this->storage, 'userSpecific' => $this->userSpecific]);
$this->prepareColumns();
$this->configureColumns();
$this->applyGridConfig();
$this->_isPjax = ArrayHelper::getValue($this->gridOptions, 'pjax', false);
if ($this->_isPjax) {
$this->gridOptions['pjaxSettings']['options']['id'] = $this->_pjaxId;
}
$this->initGrid();
}
示例5: init
/**
* @inheritdoc
*/
public function init()
{
if (empty($this->model) || !$this->model instanceof Model) {
throw new InvalidConfigException("You must enter a valid 'model' for DynaGridDetail.");
}
parent::init();
$this->_module = Config::initModule(Module::classname());
$this->_requestSubmit = $this->options['id'] . '-dynagrid-detail';
$this->_isSubmit = !empty($_POST[$this->_requestSubmit]) && $this->model->load(Yii::$app->request->post()) && $this->model->validate();
$this->registerAssets();
}
示例6: init
/**
* @inheritdoc
*/
public function init()
{
$this->_module = Config::initModule(Module::classname());
if (empty($this->options['id'])) {
$this->options['id'] = $this->getId();
}
if (!$this->toggleData) {
parent::init();
return;
}
$this->_toggleDataKey = '_tog' . hash('crc32', $this->options['id']);
$this->_isShowAll = ArrayHelper::getValue($_GET, $this->_toggleDataKey, 'page') === 'all';
if ($this->_isShowAll) {
$this->dataProvider->pagination = false;
}
parent::init();
}
示例7: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->_module = Config::initModule(Module::classname());
}
示例8: initTreeView
/**
* Initializes and validates the tree view configurations
*
* @throws InvalidConfigException
*/
protected function initTreeView()
{
$this->validateSourceData();
$this->_module = Config::initModule(Module::className());
$this->initSelectedNode();
if (empty($this->emptyNodeMsg)) {
$this->emptyNodeMsg = Yii::t('kvtree', 'No valid tree nodes are available for display. Use toolbar buttons to add tree nodes.');
}
$this->_hasBootstrap = $this->showTooltips;
$this->breadcrumbs += ['depth' => null, 'glue' => ' » ', 'activeCss' => 'kv-crumb-active', 'untitled' => Yii::t('kvtree', 'Untitled')];
}
示例9: init
/**
* @inherit doc
*/
public function init()
{
$this->validateSourceData();
$this->_module = Config::initModule(Module::classname());
$this->initSelectedNode();
if (empty($this->emptyNodeMsg)) {
$this->emptyNodeMsg = Yii::t('kvtree', 'No valid tree nodes are available for display. Use toolbar buttons to add tree nodes.');
}
parent::init();
}
示例10: rules
/**
* @inheritdoc
*/
public function rules()
{
$this->_module = Config::initModule(Module::classname());
return [[['id', 'hiddenColumns', 'visibleColumns', 'pageSize', 'filterId', 'sortId', 'theme', 'hiddenKeys', 'visibleKeys'], 'safe'], [['pageSize', 'theme'], 'required'], ['pageSize', 'integer', 'min' => $this->_module->minPageSize, 'max' => $this->_module->maxPageSize], ['pageSize', 'default', 'value' => $this->_module->defaultPageSize], ['theme', 'default', 'value' => $this->_module->defaultTheme]];
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
$this->_module = Config::initModule(Module::classname());
if (empty($this->options['id'])) {
$this->options['id'] = $this->getId();
}
if (!$this->toggleData) {
parent::init();
return;
}
$this->_toggleDataKey = '_tog' . hash('crc32', $this->options['id']);
$this->_isShowAll = ArrayHelper::getValue($_GET, $this->_toggleDataKey, $this->defaultPagination) === 'all';
if ($this->_isShowAll) {
/** @noinspection PhpUndefinedFieldInspection */
$this->dataProvider->pagination = false;
}
$this->_toggleButtonId = $this->options['id'] . '-togdata-' . ($this->_isShowAll ? 'all' : 'page');
parent::init();
}
示例12: initConfig
/**
* Initializes widget based on module settings
*
* @throws \yii\base\InvalidConfigException
*/
protected function initConfig()
{
$this->_module = Config::initModule(Module::classname());
if (!isset($this->autoWidget)) {
$this->autoWidget = $this->_module->autoWidget;
}
if (!$this->autoWidget && !empty($this->widgetClass) && !class_exists($this->widgetClass)) {
throw new InvalidConfigException("The widgetClass '{$this->widgetClass}' entered is invalid.");
}
if ($this->autoWidget === null) {
$this->autoWidget = true;
}
$this->_widgetSettings = $this->_module->widgetSettings;
if (empty($this->displayFormat)) {
$this->displayFormat = $this->_module->getDisplayFormat($this->type);
} else {
$this->displayFormat = Module::parseFormat($this->displayFormat, $this->type);
}
if (empty($this->saveFormat)) {
$this->saveFormat = $this->_module->getSaveFormat($this->type);
} else {
$this->saveFormat = Module::parseFormat($this->saveFormat, $this->type);
}
if (empty($this->displayTimezone)) {
$this->displayTimezone = $this->_module->getDisplayTimezone();
}
if (empty($this->saveTimezone)) {
$this->saveTimezone = $this->_module->getSaveTimezone();
}
if ($this->autoWidget) {
$this->_widgetSettings = [
self::FORMAT_DATE => ['class' => '\kartik\date\DatePicker'],
self::FORMAT_DATETIME => ['class' => '\kartik\datetime\DateTimePicker'],
self::FORMAT_TIME => ['class' => '\kartik\time\TimePicker'],
];
Config::validateInputWidget($this->_widgetSettings[$this->type]['class'],
"for DateControl '{$this->type}' format");
foreach ($this->_widgetSettings as $type => $setting) {
$this->_widgetSettings[$type]['options'] = $this->_module->autoWidgetSettings[$type];
$this->_widgetSettings[$type]['disabled'] = $this->disabled;
$this->_widgetSettings[$type]['readonly'] = $this->readonly;
}
}
if (empty($this->widgetClass) && !empty($this->_widgetSettings[$this->type]['class'])) {
$this->widgetClass = $this->_widgetSettings[$this->type]['class'];
}
}
示例13: init
/**
* Initialize the widget
*/
public function init()
{
parent::init();
$this->_module = Config::initModule(Module::classname());
$this->generateId();
$this->generateMessages();
$this->registerAssets();
echo Html::beginTag('div', $this->containerOptions);
echo Html::beginTag('div', $this->editorOptions);
echo $this->renderHeader();
echo $this->renderInput();
echo $this->renderFooter();
}