本文整理汇总了PHP中yii\base\Widget::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::widget方法的具体用法?PHP Widget::widget怎么用?PHP Widget::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Widget
的用法示例。
在下文中一共展示了Widget::widget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
public static function widget($config = [])
{
if (isset($config['options'])) {
$options =& $config['options'];
}
$vars = get_class_vars(get_class());
foreach ($config as $k => $v) {
if (array_key_exists($k, $vars)) {
continue;
}
$options[$k] = $v;
unset($config[$k]);
}
return parent::widget($config);
}
示例2: widget
public static function widget($config = [])
{
$id = 'widget-' . (!empty($config['id']) ? $config['id'] : uniqid());
$cache_id = !empty($config['cache']) && $config['cache'] ? $id : false;
$defaultConfig = ['options' => ['id' => $id, 'class' => 'widget-' . strtolower((new \ReflectionClass(self::classname()))->getShortName())]];
$config = array_merge_recursive($defaultConfig, $config);
if (false && $cache_id) {
$data = Yii::$app->cache->get($cache_id);
if ($data === false) {
$data = parent::widget($config);
Yii::$app->cache->set($cache_id, $data);
}
return $data;
}
return \yii\helpers\Html::tag('div', parent::widget($config), $config['options']);
}
示例3: widget
/**
* @param array $config
* @return string
*/
public static function widget($config = [])
{
if ($config['mode'] == 'import' && !isset($config['asArray'])) {
$config['asArray'] = true;
}
if (isset($config['asArray']) && $config['asArray'] == true) {
$config['class'] = get_called_class();
$widget = \Yii::createObject($config);
return $widget->run();
} else {
return parent::widget($config);
}
}
示例4: widget
public static function widget($config = [])
{
return parent::widget($config);
}
示例5: widget
public static function widget($config = array())
{
if (empty($config['languages']) || !is_array($config['languages'])) {
$config['languages'] = Yii::$app->languagepicker->languages;
}
if (empty($config['currencies']) || !is_array($config['currencies'])) {
$config['currencies'] = Yii::$app->languagepicker->currencies;
}
if (empty($config['languagesCurrenciesAssignment']) || !is_array($config['languagesCurrenciesAssignment'])) {
$config['languagesCurrenciesAssignment'] = Yii::$app->languagepicker->languagesCurrenciesAssignment;
}
return parent::widget($config);
}
示例6: widget
/**
* @inherit doc
*/
public static function widget($config = [])
{
$config = self::getConfig($config);
return parent::widget($config);
}