By plopesc on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
Field constant for cardinality was located in field.module. To clean up and get it under the responsible class, it was renamed and moved to Drupal\Core\Field\FieldStorageDefinitionInterface.
Drupal 7 and 8 before the change:
if ($element['#cardinality'] != FIELD_CARDINALITY_UNLIMITED) {
Drupal 8 after:
use Drupal\Core\Field\FieldStorageDefinitionInterface;
if ($element['#cardinality'] != FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) {
Moreover a new method isMultiple() has been added to Drupal\Core\Field\FieldStorageDefinitionInterface in order to clean up the code.
Before the change:
if ($field->getFieldCardinality() > 1 || $field->getFieldCardinality() == FIELD_CARDINALITY_UNLIMITED) {
After the change:
if ($field_storage->isMultiple()) {
Impacts:
Module developers