setLabel(t('First value')); $properties['value2'] = DataDefinition::create('string') ->setLabel(t('Second value')); return $properties; } /** * {@inheritdoc} */ public static function schema(FieldStorageDefinitionInterface $field_definition) { return [ 'columns' => [ 'value1' => [ 'type' => 'varchar', 'length' => 64, ], 'value2' => [ 'type' => 'varchar', 'length' => 64, ], ], ]; } /** * {@inheritdoc} */ public function isEmpty() { $item = $this->getValue(); return empty($item['value1']) && empty($item['value2']); } /** * {@inheritdoc} */ public static function mainPropertyName() { return 'value1'; } }