BaseFieldDefinition::setTargetBundle

public BaseFieldDefinition::setTargetBundle($bundle) Sets the bundle this field is defined for. Parameters string|null $bundle: The bundle, or NULL if the field is not bundle-specific. Return value $this File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 621 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setTargetBundle($bundle) { $this->definition['bundle'] = $bundle; return $this; }

BaseFieldDefinition::setSetting

public BaseFieldDefinition::setSetting($setting_name, $value) Sets a definition setting. Parameters string $setting_name: The definition setting to set. mixed $value: The value to set. Return value static The object itself for chaining. Overrides DataDefinition::setSetting File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 187 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setSetting($setting_name, $value) {

BaseFieldDefinition::setRevisionable

public BaseFieldDefinition::setRevisionable($revisionable) Sets whether the field is revisionable. Parameters bool $revisionable: Whether the field is revisionable. Return value $this The object itself for chaining. File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 249 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setRevisionable($revisionable) { $this->definition['revisionable'] = $revisionable; retu

BaseFieldDefinition::setQueryable

public BaseFieldDefinition::setQueryable($queryable) Sets whether the field is queryable. Parameters bool $queryable: Whether the field is queryable. Return value static The object itself for chaining. File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 302 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setQueryable($queryable) { $this->definition['queryable'] = $queryable; return $this; }

BaseFieldDefinition::setSettings

public BaseFieldDefinition::setSettings(array $settings) Note that the method does not unset existing settings not specified in the incoming $settings array. For example: // Given these are the default settings. $field_definition->getSettings() === [ 'fruit' => 'apple', 'season' => 'summer', ]; // Change only the 'fruit' setting. $field_definition->setSettings(['fruit' => 'banana']); // The 'season' setting persists unchanged. $field_definition->getSetti

BaseFieldDefinition::setProvider

public BaseFieldDefinition::setProvider($provider) Sets the name of the provider of this field. Parameters string $provider: The provider name to set. Return value $this File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 207 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setProvider($provider) { $this->definition['provider'] = $provider; return $this; }

BaseFieldDefinition::setDisplayOptions

public BaseFieldDefinition::setDisplayOptions($display_context, array $options) Sets the display options for the field in forms or rendered entities. This enables generic rendering of the field with widgets / formatters, including automated support for "In place editing", and with optional configurability in the "Manage display" / "Manage form display" UI screens. Unless this method is called, the field remains invisible (or requires ad-hoc rendering logic). Parameters string $display_context:

BaseFieldDefinition::setPropertyConstraints

public BaseFieldDefinition::setPropertyConstraints($name, array $constraints) Sets constraints for a given field item property. Note: this overwrites any existing property constraints. If you need to add to the existing constraints, use \Drupal\Core\Field\BaseFieldDefinition::addPropertyConstraints() Parameters string $name: The name of the property to set constraints for. array $constraints: The constraints to set. Return value static The object itself for chaining. File core/lib/Drupal/Core

BaseFieldDefinition::setName

public BaseFieldDefinition::setName($name) Sets the field name. Parameters string $name: The field name to set. Return value static The object itself for chaining. File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 124 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setName($name) { $this->definition['field_name'] = $name; return $this; }

BaseFieldDefinition::setDefaultValue

public BaseFieldDefinition::setDefaultValue($value) File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 478 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function setDefaultValue($value) { if ($value === NULL) { $value = []; } // Unless the value is an empty array, we may need to transform it. if (!is_array($value) || !empty($value)) { if (!is_array($value)) { $value = array(array($this->getMainP