X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fdrupal-extension%2Ffixtures%2Fdrupal8%2Fmodules%2Fbehat_test%2Fsrc%2FPlugin%2FField%2FFieldType%2FAddressFieldItem.php;fp=vendor%2Fdrupal%2Fdrupal-extension%2Ffixtures%2Fdrupal8%2Fmodules%2Fbehat_test%2Fsrc%2FPlugin%2FField%2FFieldType%2FAddressFieldItem.php;h=541104d244ea59f4b1cdb2d8df5da54eb91c35ab;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/drupal/drupal-extension/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldType/AddressFieldItem.php b/vendor/drupal/drupal-extension/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldType/AddressFieldItem.php new file mode 100644 index 000000000..541104d24 --- /dev/null +++ b/vendor/drupal/drupal-extension/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldType/AddressFieldItem.php @@ -0,0 +1,85 @@ + DataDefinition::create('string')->setLabel(t('Country')), + 'locality' => DataDefinition::create('string')->setLabel(t('Locality')), + 'thoroughfare' => DataDefinition::create('string')->setLabel(t('Thoroughfare')), + 'postal_code' => DataDefinition::create('string')->setLabel(t('Postal code')), + ]; + } + + /** + * {@inheritdoc} + */ + public static function schema(FieldStorageDefinitionInterface $field_definition) { + return [ + 'columns' => [ + 'country' => [ + 'description' => 'The ISO country code.', + 'type' => 'varchar', + 'length' => 2, + ], + 'locality' => [ + 'description' => 'The locality.', + 'type' => 'varchar', + 'length' => 255, + ], + 'thoroughfare' => [ + 'description' => 'The thoroughfare.', + 'type' => 'varchar', + 'length' => 255, + ], + 'postal_code' => [ + 'description' => 'The postal code.', + 'type' => 'varchar', + 'length' => 255, + ], + ], + ]; + } + + /** + * {@inheritdoc} + */ + public function isEmpty() { + $empty = TRUE; + foreach (['country', 'locality', 'thoroughfare', 'postal_code'] as $column) { + $empty &= $this->get($column)->getValue() === NULL; + } + return (bool) $empty; + } + +}