comparison core/lib/Drupal/Core/Field/BaseFieldDefinition.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
230 230
231 /** 231 /**
232 * {@inheritdoc} 232 * {@inheritdoc}
233 */ 233 */
234 public function isRevisionable() { 234 public function isRevisionable() {
235 return !empty($this->definition['revisionable']); 235 // Multi-valued base fields are always considered revisionable, just like
236 // configurable fields.
237 return !empty($this->definition['revisionable']) || $this->isMultiple();
236 } 238 }
237 239
238 /** 240 /**
239 * Sets whether the field is revisionable. 241 * Sets whether the field is revisionable.
240 * 242 *
260 /** 262 /**
261 * Sets the maximum number of items allowed for the field. 263 * Sets the maximum number of items allowed for the field.
262 * 264 *
263 * Possible values are positive integers or 265 * Possible values are positive integers or
264 * FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED. 266 * FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED.
267 *
268 * Note that if the entity type that this base field is attached to is
269 * revisionable and the field has a cardinality higher than 1, the field is
270 * considered revisionable by default.
265 * 271 *
266 * @param int $cardinality 272 * @param int $cardinality
267 * The field cardinality. 273 * The field cardinality.
268 * 274 *
269 * @return $this 275 * @return $this
580 /** 586 /**
581 * Sets a field that will be used for getting initial values. 587 * Sets a field that will be used for getting initial values.
582 * 588 *
583 * @param string $field_name 589 * @param string $field_name
584 * The name of the field that will be used for getting initial values. 590 * The name of the field that will be used for getting initial values.
585 * 591 * @param mixed $default_value
586 * @return $this 592 * (optional) The default value for the field, in case the inherited value
587 */ 593 * is NULL. This can be either:
588 public function setInitialValueFromField($field_name) { 594 * - a literal, in which case it will be assigned to the first property of
595 * the first item;
596 * - a numerically indexed array of items, each item being a property/value
597 * array;
598 * - a non-numerically indexed array, in which case the array is assumed to
599 * be a property/value array and used as the first item;
600 * - an empty array for no initial value.
601 * If the field being added is required or an entity key, it is recommended
602 * to provide a default value.
603 *
604 * @return $this
605 */
606 public function setInitialValueFromField($field_name, $default_value = NULL) {
589 $this->definition['initial_value_from_field'] = $field_name; 607 $this->definition['initial_value_from_field'] = $field_name;
590 608 $this->setInitialValue($default_value);
591 return $this; 609 return $this;
592 } 610 }
593 611
594 /** 612 /**
595 * {@inheritdoc} 613 * {@inheritdoc}