Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
field_collection
Commits
189329d0
Commit
189329d0
authored
Oct 01, 2019
by
klausi
Committed by
Ra Mänd
Oct 01, 2019
Browse files
Issue #2841004 by klausi: Replace confusing empty 'Too many items.' page with Access Denied page
parent
0ef247a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
field_collection.pages.inc
View file @
189329d0
...
...
@@ -118,8 +118,7 @@ function field_collection_item_add($field_name, $entity_type, $entity_id, $revis
$langcode
=
!
empty
(
$field
[
'translatable'
])
?
entity_language
(
$entity_type
,
$entity
)
:
LANGUAGE_NONE
;
if
(
!
(
$field
[
'cardinality'
]
==
FIELD_CARDINALITY_UNLIMITED
||
!
isset
(
$entity
->
{
$field_name
}[
$langcode
])
||
count
(
$entity
->
{
$field_name
}[
$langcode
])
<
$field
[
'cardinality'
]))
{
drupal_set_message
(
t
(
'Too many items.'
),
'error'
);
return
''
;
return
MENU_ACCESS_DENIED
;
}
$field_collection_item
=
entity_create
(
'field_collection_item'
,
array
(
'field_name'
=>
$field_name
));
...
...
field_collection.test
View file @
189329d0
...
...
@@ -361,7 +361,7 @@ class FieldCollectionBasicTestCase extends DrupalWebTestCase {
// Make sure adding doesn't work any more as we have restricted cardinality
// to 1.
$this
->
drupalGet
(
$path
);
$this
->
assert
Text
(
t
(
'Too many items.'
),
'Maxium cardinality has been reached.'
);
$this
->
assert
Response
(
403
);
$this
->
drupalPost
(
'field-collection/field-test-collection/1/delete'
,
array
(),
t
(
'Delete'
));
$this
->
drupalGet
(
$path
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment