yiisoft / yii2-bootstrap4 Goto Github PK
View Code? Open in Web Editor NEWYii 2 Bootstrap 4 Extension
Home Page: https://www.yiiframework.com/
License: BSD 3-Clause "New" or "Revised" License
Yii 2 Bootstrap 4 Extension
Home Page: https://www.yiiframework.com/
License: BSD 3-Clause "New" or "Revised" License
I would like to use in my project both bs3 and bs4 widgets but in different modules.
Because each extension requires the same package (bower-asset/bootstrap
) in different version constraints, it is impossible.
What do you think about to use npm-asset/bootstrap
package in yii2-bootstrap4
and keep the use bower-asset/bootstrap
twbs/bootstrap
in yii2-bootstrap
?
<?php $form = ActiveForm::begin([
'layout' => 'horizontal',
]); ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe')->checkbox() ?>
Render checkbox under text inputs
Checkbox rendered under labels
Q | A |
---|---|
Yii vesion | 2.0.15.1 |
PHP version | 7.1.23 |
Operating system | ubuntu 16.04 |
It looks like there are commits missing from yii/bootstrap. For example: https://github.com/yiisoft/yii2-bootstrap4/blob/master/src/NavBar.php#L114 should not be there anymore (see https://github.com/yiisoft/yii2-bootstrap/blob/master/src/NavBar.php#L114). This is a commit from Commits on Jun 13, 2016. Is there a reason for such a step back?
It looks like at least 4 years back in time 😀
Update Composer Lastet Version Packages Dependency,
Currently there is not a separate branch for a Yii 2.1 compatible version.
On Yii2 starter kit I can`t install this package.
Message «bower-asset/bootstrap ~4.0 -> no matching package found.» are showed
"minimum stability" set to "dev"
current YII-version - 2.0.15.1
How can I install this package?
Yii vesion: 3.0.x-dev
PHP version: 7.1.17.
Operating system: Centos7.
Hi, please update composer.json:
it would be nice to update the composer.json to keep trying yii2-boostrap4 with yii2 branch 3.0.x-dev.
"require": { "yiisoft/yii2": "~2.0.15|~2.1.0|~3.0.0", },
Something that was already bugging me with yii2-bootstrap, and is now even "worse", is the developer experience when using the Yii2 bootstrap packages.
Take for instance the Progress component.
Even with bootstrap3, creating a successful animating stripped progress at 70% is painful:
// striped animated
echo Progress::widget([
'percent' => 70,
'barOptions' => ['class' => 'progress-bar-success'],
'options' => ['class' => 'active progress-striped']
]);
Here, I need to remember the class names and what class should go on what part of the Progress element, etc.
You end up most of the time consulting the bootstrap documentation to remember the syntax, and there, you just have the plain HTML snippet sitting in front of you, that you could copy/paste and be done with.
I think that we need to care more about DX here, and that creating a progress element should be as straight forward as:
Progress::widget(['percent' => 20, 'color' => Bootstrap::SUCCESS, 'striped' => true, 'animated' => true]);
options
would be kept for a more advanced usage, when the developer really wants to stray out of bootstrap path.
Guys make breadcrumbs please
In order to just adjust the css classes according to bootstrap 4 you can also take a look at those files:
https://github.com/luyadev/luya-bootstrap4/tree/master/src
Yii vesion: 3.0.x-dev.
PHP version: 7.1.17.
Operating system: Centos7.
With yii2-bootstrap, we were able to colorize a Progress bar like this:
echo Progress::widget([
'percent' => 65,
'barOptions' => ['class' => 'progress-bar-danger']
]);
The adapted syntax for bootstrap4, with barOptions
removed from the API looks like this:
echo Progress::widget([
'bars' => [
[
'percent' => 65,
'options' => ['class' => 'progress-bar-danger']
]
],
]);
I feel like we've lost some syntactic sugar here. What was the reason for the removal of barOptions
?
There is a problem with installation if you want to use a bootstrap v3.3.7 for other parts of app.
During composer installation I got an error and package was not installed.
Try to install package on project created based on advanced yii2 template.
Make that package installed.
G:\Web\root-users\studios>..\.tools\Composer\composer.bat require yiisoft/yii2-bootstrap4
Using version ^1.0@dev for yiisoft/yii2-bootstrap4
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for yiisoft/yii2-bootstrap4 ^1.0@dev -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- Conclusion: remove bower-asset/bootstrap v3.3.7
- Conclusion: don't install bower-asset/bootstrap v3.3.7
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ^4.1.0 -> satisfiable by bower-asset/bootstrap[v4.1.3, v4.1.2, v4.1.1, v4.1.0].
- Can only install one of: bower-asset/bootstrap[v4.1.3, v3.3.7].
- Can only install one of: bower-asset/bootstrap[v4.1.2, v3.3.7].
- Can only install one of: bower-asset/bootstrap[v4.1.1, v3.3.7].
- Can only install one of: bower-asset/bootstrap[v4.1.0, v3.3.7].
- Installation request for bower-asset/bootstrap (locked at v3.3.7) -> satisfiable by bower-asset/bootstrap[v3.3.7].
Installation failed, reverting ./composer.json to its original content.
Q | A |
---|---|
Yii vesion | 2.0.15.1 |
PHP version | 7.2 |
Operating system | Windows 10 (CBB) |
Folow Modal
documentation , i.e. do:
Modal::begin([
'title' => '<h2>Hello world</h2>',
'toggleButton' => ['label' => 'click me'],
]);
A single <h2>
header tag as the modal title element.
A <h2>
wrapped inside a <h5>
.
Previous version's (BS3) Modal
required the title (a header
property actually) to be wrapped in a tag with modal-title
so that the title displayed properly. That's not the case anymore in Yii2-bs4 as an <h5>
is provided automatically, which is nice.
Version: 2.0.0
Even if I add a custom class to my Nav
element, the "nav" class is always added, which can cause certain problems.
This code:
Nav::widget([
'options' => ['class' => 'navbar-nav mr-auto'],
'items' => [
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'Folder', 'url' => ['/folder/index']],
...
],
]);
will generate this HTML:
<ul id="w1" class="navbar-nav mr-auto nav">...</ul>
I can see that the nav
class is always added here:
Line 119 in c86f479
Nav
element is inside a Navbar
element then it will make some padding issues. Removing the nav
class would solve the issue.I'm currently trying to fix the tests and it seems that resetting the widget counter has no effect. Taking ToggleButtonGroupTest
as example, neither \yii\base\Widget::$counter = 0;
nor ToggleButtonGroup::$counter = 0;
change the actual result of the test (see below).
The big problem is that even if I would test against an incremented counter ID, tests would break instantly if the order of the tests change.
Does someone of the core team have an idea why a public static property behaves like this?
Execute the tests and look for the ID's in ToggleButtonGroupTest::testRadio
(second test in the class)
Two inputs with the ID's i1
and i2
ID's i3
and i4
Q | A |
---|---|
Yii version | ~2.0 |
PHP version | 7.1 |
Operating system | Win10x64 |
Here we're implying that in order to be able to modify bootstrap CSS, we should not install bootstrap from npm
, and that we should maintain it manually instead.
The statement is obviously wrong, and I think that we might want to recommend a more modern approach, like using bootstrap from npm and properly customizing its variable in your site.scss
file:
// Customize any bootstrap variable before including the main file from npm
// @see https://github.com/twbs/bootstrap/blob/v4.1.2/scss/_variables.scss
$primary: "#ffcc00";
@import "~node_modules/bootstrap/dist/bootstrap.scss"
.customer-area {
// your own CSS
}
Would that be okay ?
In order to be able to submit the fixed tests regarding #60, I wanted to ask something beforehand:
To make ToggleButtonGroup
work in the frontend, input
need to be wrapped by label
. That makes them toggleable and hides the actual input. Currently there is no way to achieve this.
My proposal in BaseHtml::booleanInput
:
protected static function booleanInput($type, $name, $checked = false, $options = [])
{
$options['checked'] = (bool)$checked;
$value = array_key_exists('value', $options) ? $options['value'] : '1';
if (isset($options['uncheck'])) {
// add a hidden field so that if the checkbox is not selected, it still submits a value
$hiddenOptions = [];
if (isset($options['form'])) {
$hiddenOptions['form'] = $options['form'];
}
$hidden = static::hiddenInput($name, $options['uncheck'], $hiddenOptions);
unset($options['uncheck']);
} else {
$hidden = '';
}
if (isset($options['label'])) {
$label = $options['label'];
$labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
unset($options['label'], $options['labelOptions']);
if (!isset($options['id'])) {
$options['id'] = static::getId();
}
- $content = static::input($type, $name, $value, $options) . "\n";
- $content .= static::label($label, $options['id'], $labelOptions);
+ $input = static::input($type, $name, $value, $options);
+
+ if (isset($labelOptions['wrapInput']) && $labelOptions['wrapInput']) {
+ unset($labelOptions['wrapInput']);
+ $content = static::label($input . $label, $options['id'], $labelOptions);
+ } else {
+ $content = $input . "\n" . static::label($label, $options['id'], $labelOptions);
+ }
return $hidden . $content;
}
return $hidden . static::input($type, $name, $value, $options);
}
Q | A |
---|---|
Yii vesion | ~2.0 |
PHP version | 7.1 |
Operating system | Win10x64 |
If you use custom inputTemplate and place {input} into any html tag then validation error messages not showing.
<?= $form->field($model, 'test',[
'inputTemplate' => '<span>@</span>{input}',
])->textInput() ?>
<?= $form->field($model, 'test',[
'inputTemplate' => '<div>{input}</div>',
])->textInput() ?>
Q | A |
---|---|
Yii vesion | 2.0.16-dev |
PHP version | 7.1.7 |
as |
Can this be used with yii2 advanced template.
I get the following errors while trying to do composer update
Problem 1
- Conclusion: remove bower-asset/bootstrap v3.3.7
- Conclusion: don't install bower-asset/bootstrap v4.1.3
- Conclusion: don't install bower-asset/bootstrap v3.3.6
- Conclusion: remove yiisoft/yii2-bootstrap 2.0.8|install bower-asset/bootstrap v3.3.6
- Conclusion: don't install bower-asset/bootstrap v4.1.2
- Conclusion: don't install bower-asset/bootstrap v3.3.7|install bower-asset/bootstrap v4.1.3|install bower-asset/bootstrap v4.1.2
- Conclusion: don't install bower-asset/bootstrap v3.3.5
- Conclusion: don't install bower-asset/bootstrap v4.1.1
- Conclusion: don't install bower-asset/bootstrap v3.3.4
- Installation request for yiisoft/yii2-gii ~2.0.0 -> satisfiable by yiisoft/yii2-gii[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- Installation request for yiisoft/yii2-bootstrap4 ~1.0.0@dev -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- yiisoft/yii2-debug 2.0.13 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.9 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.8 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.7 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.6 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.5 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.4 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.3 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.2 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.13 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.12 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.11 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.10 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.1 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.0 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-bootstrap 2.0.8 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.1 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.2 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.3 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.4 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.5 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.6 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.7 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.0 requires bower-asset/bootstrap 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.2.0, v3.1.1, v3.1.0].
- Can only install one of: bower-asset/bootstrap[v3.3.2, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.3.1, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.3.0, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.2.0, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.1.1, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.1.0, v4.0.0].
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ~4.0 -> satisfiable by bower-asset/bootstrap[v4.1.3, v4.1.2, v4.1.1, v4.1.0, v4.0.0].
- Conclusion: don't install bower-asset/bootstrap v4.1.0
- Installation request for yiisoft/yii2-debug ~2.0.0 -> satisfiable by yiisoft/yii2-debug[2.0.0, 2.0.1, 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].
We must eliminate the dependency of the package popper, since bootstrap deleted it from its repository and uses it as an independent dependency, we must create a new extension for pooper or add the package again without depending on BootstrapPluginAsset.php, but independent PopperAsset.
Q | A |
---|---|
Yii vesion | 3.0@dev |
PHP version | 7.1.17 |
Operating system | Centos 7.0 |
class BootstrapThemeAsset extends AssetBundle
{
public $sourcePath = '@bower/bootstrap/dist';
public $css = [
'css/bootstrap-theme.css',
];
public $depends = [
'yii\bootstrap4\BootstrapAsset',
];
}
the css/bootstrap-theme.css file does not exist!
At this moment, all tests have been fixed and pass. Except HHVM.
The log (https://travis-ci.org/yiisoft/yii2-bootstrap4/jobs/432235776) says:
Fatal error: Uncaught Error: array_creation_expression is not allowed in write context in /home/travis/build/yiisoft/yii2-bootstrap4/vendor/phpunit/phpunit/src/Framework/TestCase.php:1270
The line in question:
[$category, $locale] = $args;
Now I'm asking myself:
Yii: 2.0.15.
Hi composer.json:
"autoload": {
"psr-4": {
"yii\\bootstrap\\": "src"
}
},
PopperAsset.php it is located in the root directory of the extension and not in the src directory,
Thks.
yii2.1 with bootstrap4 works well, we only have the problem of the different route of jquery in 2.0 and 2.1, seeing the roadmap of yii2.1 there are extensions that will be free of jquery, this is the time to do the same with bootstrap4 since You do not need jquery, as we are starting bootstrap4 it would be great to start with the new approaches.
<?php $form = ActiveForm::begin([
'id' => 'form-step',
'layout' => 'horizontal',
**'fieldClass' => 'yii\bootstrap4\ActiveField',**
'fieldConfig' => [
'options' => ['class' => 'form-group row'],
'horizontalCssClasses' => [
'label' => 'col-lg-6',
'error' => 'invalid-tooltip row px-3',
'wrapper' => 'col-lg-6 position-relative',
],
],
'options' => ['class' => 'pr-md-3 pr-lg-0 w-100'],
]) ?>
<?= $form->field($model, 'type', ['horizontalCssClasses' => ['wrapper' => 'col-xl-8 col-lg-10 position-relative']])->radioList(ArrayHelper::map($model->getTypeProject(), 'value', 'name'), [
'class' => 'px-3 row',
'aria-expanded' => 'true',
'role' => 'listbox',
**'item' => function** ($index, $label, $name, $checked, $value){
switch ($index) {
case 0:
$checked = ' checked';
$icon = Yii::$app->params['icon_equip'];
break;
case 1:
$icon = Yii::$app->params['icon_mobile'];
break;
case 2:
$icon = Yii::$app->params['icon_target'];
break;
case 3:
$icon = Yii::$app->params['icon_speaker'];
break;
case 4:
$icon = Yii::$app->params['icon_tower'];
break;
case 5:
$icon = Yii::$app->params['icon_program'];
break;
default:
$icon = false;
}
$return = "<div class='col-6 col-sm-4 px-0'>";
$return .= "<input id='type-{$index}' type='radio' class='d-none check-type' name='{$name}' value='{$value}'" . $checked . ">";
$return .= "<label for='type-{$index}' class='d-flex flex-column h-100 justify-content-center p-4 w-100'>";
$return .= "<span class='mb-4'>{$icon}</span>";
$return .= "<span class='corner'>{$label}</span>";
$return .= '</label>';
return .= "</div>";
return $return;
},
])->label(false) ?>
<div class="form-check">
<input type="radio" id="i0" class="form-check-input" name="AppForm[type]" value="0">
<label class="form-check-label" for="i0">123</label>
</div>
<div class="col-6 col-sm-4 px-0">
<input id="type-0" type="radio" class="d-none check-type" name="AppForm[type]" value="0" checked="">
<label for="type-0" class="d-flex flex-column h-100 justify-content-center p-4 w-100">
<span class="mb-4"><svg></svg></span>
<span class="corner">123</span>
</label>
</div>
Q | A |
---|---|
Yii vesion | 2.0.16-dev |
PHP version | 7.2.8 |
Operating system | Windows 10 |
"yiisoft/yii2-bootstrap4": "~1.0.0"
, to composer.jsonSuccessful installation.
Installation fails with
Problem 1
- Installation request for yiisoft/yii2-bootstrap4 ~1.0.0 -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ^4.1.0 -> no matching package found.
Q | A |
---|---|
Yii version | 2.0.15.1 |
PHP version | 7.2.9 |
Operating system | Windows 10 Pro |
My app config:
'assetManager' => [
'class' => 'yii\web\AssetManager',
'bundles' => [
'yii\web\JqueryAsset' => [
'js' => [
YII_ENV_DEV ? 'jquery.js' : 'jquery.min.js'
]
],
'yii\bootstrap4\BootstrapAsset' => [
'sourcePath' => null,
'baseUrl' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1',
'css' => [
YII_ENV_DEV ? 'css/bootstrap.css' : 'css/bootstrap.min.css',
]
],
'yii\bootstrap4\BootstrapPluginAsset' => [
'sourcePath' => null,
'baseUrl' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1',
'js' => [
YII_ENV_DEV ? 'js/bootstrap.js' : 'js/bootstrap.min.js',
YII_ENV_DEV ? 'js/bootstrap.bundle.js' : 'js/bootstrap.bundle.min.js',
]
]
],
],
composer.json config
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap4": "~1.0.0",
...
},
"replace": {
"bower-asset/bootstrap": ">=3.3.0"
},
(1) I try uing Nav::widget
-->
(2) \vendor\yiisoft\yii2-bootstrap4\src\Dropdown.php at line 89
BootstrapPluginAsset::register($this->getView());
-->
(3) \vendor\yiisoft\yii2\web\AssetManager.php
The file or directory to be published does not exist: .../vendor\bower/bootstrap/assets/js/vendor
What did I do wrong?
Q | A |
---|---|
Yii vesion | 2.0.15 |
PHP version | 7.0.6 |
Operating system | Win XAMPP |
Could you draft at least one release? Say, v0.1.0 or something like that.
We can't use this package in composer.json with "minimum-stability": "stable".
According to https://blog.getbootstrap.com/2019/02/11/bootstrap-4-3-0/ new version of bootstrap available. Do this project possible to use with it out of box or some changes required?
https://github.com/yiisoft/yii2-bootstrap4/blob/master/src/BootstrapPluginAsset.php#L24
public $depends = [
'yii\web\JqueryAsset',
But, https://github.com/yiisoft/yii2/blob/3.0/framework/UPGRADE.md
Assets yii\web\JqueryAsset, yii\web\YiiAsset, yii\validators\ValidationAsset have been moved under yii\jquery* namespace. Make sure you refer to the new full-qualified names of this classes.
Because of this, we get an error: Class yii\web\JqueryAsset not found...
Q | A |
---|---|
Yii vesion | 3.0@dev |
PHP version | any |
Operating system | any |
This extension seems almost ready and is already totaling ~20k downloads :)
We should probably publish a first stable release into the wild and see how it plays.
We still need to:
@simialbi do you have the time to look at the open issues? (no pressure)
Parameter autoCloseItems => true do not lead to the closure of other elements of the accordion
`
echo \yii\bootstrap4\Accordion::widget([
'options'=>['class' => ''],
'itemToggleOptions' => [
'tag' => 'a',
'type' => false,
'class' => 'collapsed',
],
'encodeLabels'=>false,
'autoCloseItems'=>true,
'items' => []
])`
According to BS4 docs, "Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler." (https://getbootstrap.com/docs/4.1/components/navbar/#toggler)
Should a new NavBar option be introduced to left or right align the toggler?
Install yii2 with basic config
Install bootstrap4 extension
Change asset import in main.php with bootstrap4 instead of boostrap
Generate a simple CRUD
Form validation error showing "red" message
glyph icons showing in table
Form validation stays black with message "cannot be blank"
glyph icons not showing
Q | A |
---|---|
Yii vesion | 2.0.14 |
PHP version | 7.1.12 |
Operating system | Windows 10 (WAMP) |
Add a BS4 tab widget to a page.
Click on the tabs ... nothing happens
Tab label html content should not show up
When you click on a tab, you should see the content for that tab
Tab label html shows up as code
tab border appears when you hover, but when you click, nothing happens
Q | A |
---|---|
Yii version | 2.0.16 |
PHP version | 7.1.23 |
Operating system | macOS 10.14.3 |
jQuery | 3.3.1 |
Navbar.php
Current Code:
Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-toggleable-xs']);
BS 4.1 Code:
Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-collapse']);
Regards,
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap4": "~1.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0",
"bower-asset/bootstrap": "4.*",
"bower-asset/font-awesome": "4.*"
},
Causes Invalid Argument – yii\base\InvalidArgumentException
directory not found /vendor/bower-asset/bootstrap/js/vendor
I should use "bower-asset/bootstrap": "4.0.0" instead
I used yii2-bootstrap4. That's all. When I am using PopperAsset it's giving the "The file or directory to be published does not exist: /../../vendor/bower-asset/bootstrap/assets/js/vendor". Seems the path is wrong. And seems right path: @bower/bootstrap/site/docs/4.1/assets/js/vendor
Link: https://github.com/twbs/bootstrap/blob/v4-dev/site/docs/4.1/assets/js/vendor/popper.min.js
Q | A |
---|---|
Yii vesion | 2.0.16 |
PHP version | 7.2 |
Operating system | Linux |
The reason is, because the value gets encoded either way (see https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseHtml.php#L1941)
So either the value gets double-encoded or it gets encoded when it shouldn't.
Currently there is no way to override this behavior.
So either the option gets removed from this extension and reduces configuration possibilities OR (which may break some stuff) the yii\helpers\BaseHtml
gets changed.
See https://github.com/yiisoft/yii2-bootstrap4/blob/master/tests/HtmlTest.php#L60
This second dataset for testStaticControl()
doesn't pass a 'encoded' => false
in the options, so by default, the value will get encoded the first time. Later, when the input
tag gets rendered, the value gets encoded a second time, because $value !== null
.
The value <html>
should become <html>
The value <html>
becomes &lt;html&gt;
(double-encoded)
Q | A |
---|---|
Yii vesion | ~2.0 |
PHP version | 7.1 |
Operating system | Wins10x64 |
Documentation reads:
Since we're rolling out the first official stable release, shouldn't we remove it right away?
I tried to fix the TravisCI build error. After a while I got the test suite to run completely on my local machine with a few tests still failing. But at least no more error.
~2.1@dev|~3.0@dev
from yii2 in composer.json
. Those were added by @simialbi and @dmirogin, but not sure about the idea behind it. As far as I know there is no Yii v2.1 (yet) and v3.0 still WIP. Those will not work with the bootstrap4 extension because JqueryAsset
is missing.widget
array around the classes in https://github.com/yiisoft/yii2-bootstrap4/blob/master/src/ToggleButtonGroup.php#L66 which threw an "array to string conversion" exception. This change was made by @simialbi, maybe he can clarify why.These would be the first important steps to fix the build process.
Test suite runs without errors.
...
Q | A |
---|---|
Yii vesion | 2.0.14 |
PHP version | 7.1 |
Operating system | Win10 |
Yii: 2.0.15.
PHP: 7.1
Hi packagist.org:
Current Update:
e98188106e7fb1ce5efb13ec1e39449f34ef5385
Cuurent Update Github:
5b4861a8f53f8029675e812d096e9c9a8a60294f
Thks,
Running composer require --prefer-dist yiisoft/yii2-bootstrap4
I was expecting Bootstrap 3 already installed to be updated to version 4
Got this error: Could not find a version of package yiisoft/yii2-bootstrap4 matching your minimum-stability (stable)...
Q | A |
---|---|
Yii vesion | 2.0.15.1 |
PHP version | 7.2.5RC1 |
Operating system | Windows 7 pro |
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-swiftmailer": "~2.0.0",
"yiisoft/yii2-bootstrap4": "~1.0.0"
},
The requested package yiisoft/yii2-bootstrap4 ~1.0.0 is satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev] but these conflict with your requirements or minimum-stability.
Q | A |
---|---|
Yii vesion | latest |
PHP version | 5.4 |
Operating system | Mac OS |
The Dropdown::encodeLabels
property is not cascaded to lower children submenu levels. This is because Line 136 does not use the encodeLabels
setting when making the recursive call to the widget.
All child menu levels should use the Dropdown::encodeLabels
if item level encode
setting is not set.
Only first menu level uses the encodeLabels
property - not the child levels. I will be submitting a PR #56 to correct this.
Q | A |
---|---|
Yii vesion | 2.x |
PHP version | 7.x |
Operating system | All |
It would be nice to include a paragraph or more in the docs about what's required to upgrade from yii2-bootstrap
to this extension.
Is there any changes that people would be confused about? Any quick adaptations that come to mind?
The ButtonDropdown always renders a <div class="dropdown">
container. This should be made optional - as it is not required for rendering within a form input group as seen here.
ButtonDropdown container should be made optional via a property.
Currently container is always rendered. Will update over PR # 56.
Q | A |
---|---|
Yii vesion | 2.x |
PHP version | 7.x |
Operating system | All |
I'm trying to use Bootstrap4 through the official CDN. I followed the steps as outlined in the assets setup but when I try to run the program I get an error that says "Class yii\bootstrap4\BootstrapAsset does not exist". I would rather use the CDN than download a package; is it even possible? I did so many web searches but I couldn't figure out how to get things to work.
I configured assetManager in /frontend/config/main.php
as the guide told me to and copied the following into the composer.json
file:
"replace": { "bower-asset/bootstrap": ">=4.1.1" },
Can't figure out how to get it to work. Any help would be appreciated, thanks!
Q | A |
---|---|
Yii vesion | Latest stable release 2.* |
PHP version | 7.* |
Operating system | Windows |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.