diff --git a/field_collection.pages.inc b/field_collection.pages.inc index 8543390..e21bcd6 100644 --- a/field_collection.pages.inc +++ b/field_collection.pages.inc @@ -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)); diff --git a/field_collection.test b/field_collection.test index 051ee46..02ced78 100644 --- a/field_collection.test +++ b/field_collection.test @@ -356,7 +356,7 @@ class FieldCollectionBasicTestCase extends DrupalWebTestCase { // Make sure adding doesn't work any more as we have restricted cardinality // to 1. $this->drupalGet($path); - $this->assertText(t('Too many items.'), 'Maxium cardinality has been reached.'); + $this->assertResponse(403); $this->drupalPost('field-collection/field-test-collection/1/delete', array(), t('Delete')); $this->drupalGet($path);