Skip to content

Commit

Permalink
Merge branch 'master' into cake-5
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 31, 2022
2 parents 34a22b4 + fad8ab9 commit 060cd10
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
php-version: '8.1'
extensions: mbstring, intl
coverage: none
tools: vimeo/psalm:4.23, phpstan:1.7, cs2pr
tools: vimeo/psalm:4, phpstan:1.9, cs2pr

- name: Composer Install
run: composer require --dev cakephp/cakephp-codesniffer:5.x-dev
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
"wiki": "http://cakephp.nu/cakephp-crud/",
"irc": "irc://irc.freenode.org/friendsofcake"
},
"prefer-stable": true,
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alabaster==0.7.12
Babel==2.9.1
cakephp-theme==1.1.3
certifi==2019.11.28
certifi==2022.12.7
chardet==3.0.4
docutils==0.15.2
idna==2.8
Expand Down
17 changes: 1 addition & 16 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Access to an undefined property object\\:\\:\\$element\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Access to an undefined property object\\:\\:\\$query\\.$#"
count: 4
path: src/Listener/ViewListener.php

-
message: "#^Access to an undefined property object\\:\\:\\$type\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Cannot unset offset mixed on array\\.$#"
message: "#^Cannot unset offset mixed on array\\{\\}\\.$#"
count: 2
path: src/Listener/ViewListener.php

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ includes:
parameters:
level: 7
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src
universalObjectCratesClasses:
Expand Down
6 changes: 5 additions & 1 deletion src/Listener/Traits/FormTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ protected function _getDefaultExtraLeftButtons(): array
$action = $this->_action();
if ($action instanceof EditAction) {
$blacklist = $action->getConfig('scaffold.actions_blacklist', []);
if (!in_array('delete', $blacklist, true)) {
if (
!in_array('delete', $blacklist, true) &&
$this->_crud()->isActionMapped('delete') &&
$this->_crud()->action('delete')->enabled()
) {
$buttons[] = [
'title' => __d('crud', 'Delete'),
'url' => ['action' => 'delete'],
Expand Down
5 changes: 4 additions & 1 deletion src/Listener/ViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ protected function _getAllowedActions(): array
$blacklist = (array)$this->_action()->getConfig('scaffold.actions_blacklist');
$blacklist = array_combine($blacklist, $blacklist);
foreach ($this->_crud()->getConfig('actions') as $action => $config) {
if ($config['className'] === 'Crud.Lookup') {
if (
$config['className'] === 'Crud.Lookup' ||
!$this->_crud()->action($action)->enabled()
) {
$blacklist[$action] = $action;
}
}
Expand Down
2 changes: 1 addition & 1 deletion webroot/js/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var CrudView = {
query[$ele.data('filter-field') || $ele.attr('name')] = params.term;

if ($ele.data('dependent-on') && $('#' + $ele.data('dependent-on')).val()) {
data[$ele.data('dependent-on-field')] = $('#' + $ele.data('dependent-on')).val();
query[$ele.data('dependent-on-field')] = $('#' + $ele.data('dependent-on')).val();
}

return query;
Expand Down

0 comments on commit 060cd10

Please sign in to comment.