Skip to content

Commit 3bd2963

Browse files
authored
Merge pull request #415 from FriendsOfCake/next
Next
2 parents c73af02 + c79273e commit 3bd2963

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1403
-1602
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ composer.lock
33
node_modules
44
.phpunit.result.cache
55
.phpunit.cache
6+
/tools
67

78
# Generated test files
89
tests/test_app/webroot/bootstrap_u_i

.phive/phars.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
3+
<phar name="phpstan" version="2.0.2" installed="2.0.2" location="./tools/phpstan" copy="false"/>
44
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
55
</phive>

README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ For version info see [version map](https://github.com/FriendsOfCake/bootstrap-ui
2222
## Requirements
2323

2424
* CakePHP 5.x
25-
* Bootstrap 5.x
25+
* Bootstrap 5.3.x
2626
* npm 6.x
27-
* Popper.js 2.x
28-
* Bootstrap Icons 1.5.x
27+
* Bootstrap Icons 1.11.x
2928

3029
## What's included?
3130

@@ -72,7 +71,7 @@ You can either use the Bootstrap commands to make the necessary changes, or do t
7271

7372
### Using the Bootstrap commands
7473

75-
1. To install the Bootstrap assets (Bootstrap's CSS/JS files, Popper.js) via npm you can use the `install`
74+
1. To install the Bootstrap assets (Bootstrap's CSS/JS files) via npm you can use the `install`
7675
command, or [install them manually](#installing-bootstrap-assets-via-npm):
7776

7877
```
@@ -119,16 +118,14 @@ do manually if you wish to control which assets are being included, and where th
119118
Assuming you are in your application's root:
120119

121120
```
122-
npm install @popperjs/core@2 bootstrap@5 bootstrap-icons@1
121+
npm install bootstrap@5 bootstrap-icons@1
123122
mkdir -p webroot/css
124123
mkdir -p webroot/font/fonts
125124
mkdir -p webroot/js
126-
cp node_modules/@popperjs/core/dist/umd/popper.js webroot/js
127-
cp node_modules/@popperjs/core/dist/umd/popper.min.js webroot/js
128125
cp node_modules/bootstrap/dist/css/bootstrap.css webroot/css/
129126
cp node_modules/bootstrap/dist/css/bootstrap.min.css webroot/css/
130-
cp node_modules/bootstrap/dist/js/bootstrap.js webroot/js/
131-
cp node_modules/bootstrap/dist/js/bootstrap.min.js webroot/js/
127+
cp node_modules/bootstrap/dist/js/bootstrap.bundle.js webroot/js/
128+
cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js webroot/js/
132129
cp node_modules/bootstrap-icons/font/bootstrap-icons.css webroot/font/
133130
cp node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff webroot/font/fonts/
134131
cp node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2 webroot/font/fonts/
@@ -245,7 +242,7 @@ them using the standard plugin syntax:
245242
// in the <head>
246243
echo $this->Html->css('BootstrapUI.bootstrap.min');
247244
echo $this->Html->css(['BootstrapUI./font/bootstrap-icons', 'BootstrapUI./font/bootstrap-icon-sizes']);
248-
echo $this->Html->script(['BootstrapUI.popper.min', 'BootstrapUI.bootstrap.min']);
245+
echo $this->Html->script(['BootstrapUI.bootstrap.bundle.min']);
249246
```
250247

251248
If you have installed the assets manually, you'll need to use paths accordingly. With
@@ -254,15 +251,15 @@ If you have installed the assets manually, you'll need to use paths accordingly.
254251
```php
255252
echo $this->Html->css('bootstrap.min');
256253
echo $this->Html->css(['/font/bootstrap-icons', '/font/bootstrap-icon-sizes']);
257-
echo $this->Html->script(['popper.min', 'bootstrap.min']);
254+
echo $this->Html->script(['bootstrap.bundle.min']);
258255
```
259256

260257
If you're using paths that don't adhere to the CakePHP conventions, you'll have to explicitly specify them:
261258

262259
```php
263260
echo $this->Html->css('/path/to/bootstrap.css');
264261
echo $this->Html->css(['/path/to/bootstrap-icons.css', '/path/to/bootstrap-icon-sizes.css']);
265-
echo $this->Html->script(['/path/to/popper.js', '/path/to/bootstrap.js']);
262+
echo $this->Html->script(['/path/to/bootstrap.bundle.js']);
266263
```
267264

268265
## Bake templates
@@ -343,7 +340,7 @@ Horizontal forms automatically render labels and controls in separate columns (w
343340
one, and controls in the second one.
344341

345342
Alignment can be configured via the `align` option, which takes either a list of column sizes for the `md`
346-
[Bootstrap screen-size/breakpoint](https://getbootstrap.com/docs/5.0/layout/breakpoints/), or a matrix of
343+
[Bootstrap screen-size/breakpoint](https://getbootstrap.com/docs/5.3/layout/breakpoints/), or a matrix of
347344
screen-size/breakpoint names and column sizes.
348345

349346
The following will use the default `md` screen-size/breakpoint:
@@ -477,8 +474,8 @@ will render this HTML:
477474
### Spacing
478475

479476
Out of the box BootstrapUI applies some default spacing for form controls. For default and horizontal aligned forms,
480-
the `mb-3` [spacing class](https://getbootstrap.com/docs/5.0/utilities/spacing/) is being applied to all controls,
481-
while inline forms are using the `g-3` [gutter class](https://getbootstrap.com/docs/5.0/layout/gutters/).
477+
the `mb-3` [spacing class](https://getbootstrap.com/docs/5.3/utilities/spacing/) is being applied to all controls,
478+
while inline forms are using the `g-3` [gutter class](https://getbootstrap.com/docs/5.3/layout/gutters/).
482479

483480
This can be changed using the `spacing` option, it applies on a per-helper and per-form basis for all alignments, and
484481
for default/horizontal alignments it also applies on a per-control basis.
@@ -655,7 +652,7 @@ This would generate the following HTML:
655652

656653
### Switches
657654

658-
[Switch style checkboxes](https://getbootstrap.com/docs/5.0/forms/checks-radios/#switches) can be created by setting the
655+
[Switch style checkboxes](https://getbootstrap.com/docs/5.3/forms/checks-radios/#switches) can be created by setting the
659656
`switch` option to `true`.
660657

661658
```php
@@ -677,7 +674,7 @@ This would generate the following HTML:
677674

678675
### Floating labels
679676

680-
[Floating labels](https://getbootstrap.com/docs/5.0/forms/floating-labels) are supported for `text`, `textarea`, and
677+
[Floating labels](https://getbootstrap.com/docs/5.3/forms/floating-labels) are supported for `text`, `textarea`, and
681678
(non-`multiple`) `select` controls. They can be enabled via the label's `floating` option:
682679

683680
```php
@@ -746,7 +743,7 @@ This would generate the following HTML:
746743

747744
### Tooltips
748745

749-
[Bootstrap tooltips](https://getbootstrap.com/docs/5.0/components/tooltips/) can be added to labels via the `tooltip`
746+
[Bootstrap tooltips](https://getbootstrap.com/docs/5.3/components/tooltips/) can be added to labels via the `tooltip`
750747
option. The tooltip toggles are by default being rendered as a [Bootstrap icon](https://icons.getbootstrap.com/), which
751748
is being included by default when installing the assets via the `install` command.
752749

@@ -1001,7 +998,7 @@ echo $this->Html->badge('Text');
1001998

1002999
#### Background colors
10031000

1004-
[Background colors](https://getbootstrap.com/docs/5.0/components/badge/#background-colors) can be changed by specifying
1001+
[Background colors](https://getbootstrap.com/docs/5.3/components/badge/#background-colors) can be changed by specifying
10051002
one of the Bootstrap theme color names via the `class` option, the helper will make sure that the correct prefixes
10061003
are being applied:
10071004

@@ -1155,7 +1152,7 @@ This would generate the following HTML:
11551152
#### Configuring the ARIA labels
11561153

11571154
When using the standard methods you can use the `label` option to pass a custom string to use for
1158-
[the `aria-label` attribute](https://getbootstrap.com/docs/5.0/components/pagination/#working-with-icons):
1155+
[the `aria-label` attribute](https://getbootstrap.com/docs/5.3/components/pagination/#working-with-icons):
11591156

11601157
```php
11611158
echo $this->Paginator->first('«', ['label' => __('Beginning')]);
@@ -1276,7 +1273,7 @@ This would generate the following HTML:
12761273

12771274
##### Sizing
12781275

1279-
[The size](https://getbootstrap.com/docs/5.0/components/pagination/#sizing) can be specified via the `size` option:
1276+
[The size](https://getbootstrap.com/docs/5.3/components/pagination/#sizing) can be specified via the `size` option:
12801277

12811278
```php
12821279
echo $this->Paginator->links([

composer.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
}
1818
],
1919
"require": {
20-
"cakephp/cakephp": "^5.0"
20+
"cakephp/cakephp": "^5.1.4"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^10.1",
23+
"phpunit/phpunit": "^10.5.5 || ^11.1.3",
2424
"cakephp/bake": "^3.0",
25-
"cakephp/cakephp-codesniffer": "^5.0"
25+
"cakephp/cakephp-codesniffer": "^5.1"
2626
},
2727
"support": {
2828
"issues": "http://github.com/friendsofcake/bootstrap-ui/issues",
@@ -47,8 +47,13 @@
4747
"cs-check": "phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=comparisons src/ tests/",
4848
"cs-fix": "phpcbf --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=comparisons src/ tests/",
4949
"test": "phpunit",
50-
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.0.0 && mv composer.backup composer.json",
51-
"stan": "phpstan analyze"
50+
"phpstan": "tools/phpstan",
51+
"psalm": "tools/psalm",
52+
"stan": [
53+
"@phpstan",
54+
"@psalm"
55+
],
56+
"stan-setup": "phive install"
5257
},
5358
"config": {
5459
"allow-plugins": {

package-lock.json

Lines changed: 43 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"dependencies": {
3-
"@popperjs/core": "^2.9.2",
4-
"bootstrap": "^5.0.1",
5-
"bootstrap-icons": "^1.5.0"
3+
"bootstrap": "^5.3.3",
4+
"bootstrap-icons": "^1.11.3"
65
}
76
}

src/BootstrapUIPlugin.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,34 @@ class BootstrapUIPlugin extends BasePlugin
2626
*/
2727
protected bool $bootstrapEnabled = false;
2828

29+
/**
30+
* Enable middleware
31+
*
32+
* @var bool
33+
*/
34+
protected bool $middlewareEnabled = false;
35+
36+
/**
37+
* Register container services
38+
*
39+
* @var bool
40+
*/
41+
protected bool $servicesEnabled = false;
42+
2943
/**
3044
* Load routes or not
3145
*
3246
* @var bool
3347
*/
3448
protected bool $routesEnabled = false;
3549

50+
/**
51+
* Load events or not
52+
*
53+
* @var bool
54+
*/
55+
protected bool $eventsEnabled = false;
56+
3657
/**
3758
* @inheritDoc
3859
*/

src/Command/InstallCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function installPackages(Arguments $args, ConsoleIo $io): void
5959
$output = [];
6060
$return = 0;
6161
$this->_runNPMInstall($output, $return, $io, $args->getOption('latest') === true);
62-
$io->out($output); // @phpstan-ignore argument.type
62+
$io->out($output);
6363

6464
if ($return !== 0) {
6565
$io->error('Package installation failed.');
@@ -352,7 +352,6 @@ protected function _findPackageAssets(): array
352352

353353
$nodeModulesPath = Plugin::path('BootstrapUI') . 'node_modules' . DS;
354354
$paths = [
355-
$nodeModulesPath . '@popperjs/core/dist/umd',
356355
$nodeModulesPath . 'bootstrap/dist',
357356
$nodeModulesPath . 'bootstrap-icons',
358357
];

src/View/Helper/BreadcrumbsHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function render(array $attributes = [], array $separator = []): string
4949
/**
5050
* @inheritDoc
5151
*/
52-
public function add($title, $url = null, array $options = [])
52+
public function add(array|string $title, array|string|null $url = null, array $options = [])
5353
{
5454
if (is_array($title)) {
5555
$crumbs = [];
@@ -74,7 +74,7 @@ public function add($title, $url = null, array $options = [])
7474
/**
7575
* @inheritDoc
7676
*/
77-
public function prepend($title, $url = null, array $options = [])
77+
public function prepend(array|string $title, array|string|null $url = null, array $options = [])
7878
{
7979
$options = $this->injectClasses($this->_defaultAttributes['class']['item'], $options);
8080

@@ -84,7 +84,7 @@ public function prepend($title, $url = null, array $options = [])
8484
/**
8585
* @inheritDoc
8686
*/
87-
public function insertAt(int $index, string $title, $url = null, array $options = [])
87+
public function insertAt(int $index, string $title, array|string|null $url = null, array $options = [])
8888
{
8989
$options = $this->injectClasses($this->_defaultAttributes['class']['item'], $options);
9090

0 commit comments

Comments
 (0)