Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/howto/custom_field_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Which one you choose depends if the field definition settings and constraints im

### Mapping with configuration
You need to use a simple compiler pass to modify a container parameter, `ibexa.graphql.schema.content.mapping.field_definition_type`.
It is a hash that maps a field type identifier (`ezstring`) to the following entries:
It is a hash that maps a field type identifier (`ibexa_string`) to the following entries:
- `value_type`: the GraphQL type values of this field are represented as. It can either be a native type
(`String`, `Int`...), or a custom type that you will define.
If not specified, `String` will be used.
Expand Down Expand Up @@ -161,7 +161,7 @@ class RelationFieldDefinitionMapper extends DecoratingFieldDefinitionMapper impl
```

#### Mutation input type handling
If the input for a field depends on the field definition, like `ezmatrix`
If the input for a field depends on the field definition, like `ibexa_matrix`
which generates its own input types depending on the configured columns, use `mapToFieldValueInputType`
which returns a GraphQL type for a Field Definition.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function it_maps_single_selection_to_resolve_single(): void
private function createFieldDefinition(int $selectionLimit = 0, array $selectionContentTypes = []): FieldDefinition
{
return new FieldDefinition([
'fieldTypeIdentifier' => 'ezobjectrelationlist',
'fieldTypeIdentifier' => 'ibexa_object_relation_list',
'fieldSettings' => [
'selectionContentTypes' => $selectionContentTypes,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class SelectionFieldDefinitionMapperSpec extends ObjectBehavior
{
public const FIELD_IDENTIFIER = 'test';
public const TYPE_IDENTIFIER = 'ezselection';
public const TYPE_IDENTIFIER = 'ibexa_selection';

public function let(FieldDefinitionMapper $innerMapper): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AddFieldDefinitionToItemTypeSpec extends ObjectBehavior
public const FIELD_IDENTIFIER = 'test_field';
public const FIELD_NAME = 'testField';
public const FIELD_DESCRIPTION = ['eng-GB' => 'Description'];
public const FIELD_TYPE = 'ezstring';
public const FIELD_TYPE = 'ibexa_string';
public const FIELD_DEFINITION_TYPE = 'TestFieldDefinition';

/**
Expand Down
44 changes: 22 additions & 22 deletions src/bundle/Resources/config/default_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,84 @@ parameters:
ibexa.graphql.schema.content.field_name.override:
id: id_
ibexa.graphql.schema.content.mapping.field_definition_type:
ezauthor:
ibexa_author:
value_type: "[AuthorFieldValue]"
value_resolver: 'field !== null ? field.authors : null'
input_type: '[AuthorInput]'
ezbinaryfile:
ibexa_binaryfile:
definition_type: BinaryFieldDefinition
value_type: BinaryFileFieldValue
input_type: BinaryFieldInput
ezboolean:
ibexa_boolean:
definition_type: CheckboxFieldDefinition
value_type: Boolean
value_resolver: 'field !== null ? field.bool : null'
input_type: Boolean
ezcountry:
ibexa_country:
definition_type: CountryFieldDefinition
value_type: String
input_type: '[String]'
ezdate:
ibexa_date:
value_type: DateTime
value_resolver: 'field !== null ? field.date : null'
input_type: DateFieldInput
ezdatetime:
ibexa_datetime:
value_type: DateTime
value_resolver: 'field !== null ? field.value : null'
input_type: DateFieldInput
ezemail:
ibexa_email:
value_type: String
ezuser:
ibexa_user:
value_type: String
value_resolver: 'field.id'
ezfloat:
ibexa_float:
definition_type: FloatFieldDefinition
value_type: Float
value_resolver: 'field !== null ? field.value : null'
input_type: Float
ezgmaplocation:
ibexa_gmap_location:
value_type: MapLocationFieldValue
input_type: 'MapLocationFieldInput'
ezimage:
ibexa_image:
definition_type: BinaryFieldDefinition
value_type: ImageFieldValue
input_type: ImageFieldInput
ezimageasset:
ibexa_imageasset:
value_type: ImageFieldValue
value_resolver: 'query("DomainImageAssetFieldValue", field)'
ezinteger:
ibexa_integer:
definition_type: IntegerFieldDefinition
value_type: Int
value_resolver: 'field !== null ? field.value : null'
input_type: Int
ezkeyword:
ibexa_keyword:
value_type: '[String]'
value_resolver: 'field !== null ? field.values : null'
input_type: '[String]'
ezmedia:
ibexa_media:
definition_type: MediaFieldDefinition
value_type: MediaFieldValue
input_type: MediaFieldInput
ezobjectrelation:
ibexa_object_relation:
definition_type: RelationFieldDefinition
value_type: RelationFieldValue
input_type: Int
ezobjectrelationlist:
ibexa_object_relation_list:
definition_type: RelationListFieldDefinition
value_type: RelationListFieldValue
input_type: '[Int]'
ezrichtext:
ibexa_richtext:
value_type: RichTextFieldValue
input_type: RichTextFieldInput
ezselection:
ibexa_selection:
definition_type: SelectionFieldDefinition
input_type: '[Int]'
ezstring:
ibexa_string:
definition_type: TextLineFieldDefinition
value_type: String
eztext:
ibexa_text:
definition_type: TextBlockFieldDefinition
value_type: String
ezurl:
ibexa_url:
value_type: UrlFieldValue
input_type: UrlFieldInput
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ FieldDefinition:
description: "The position of the field definition in the content type"
fieldTypeIdentifier:
type: String
description: "The identifier of the field type (ezstring, ezinteger...)."
description: "The identifier of the field type (ibexa_string, ibexa_integer...)."
isThumbnail:
type: Boolean
description: "Indicates if this field can be a thumbnail."
Expand Down
42 changes: 21 additions & 21 deletions src/bundle/Resources/config/services/mutations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,108 +15,108 @@ services:
arguments:
$fieldType: '@Ibexa\Core\FieldType\Author\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezauthor' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_author' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\BinaryFile:
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezbinaryfile' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_binaryfile' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Boolean:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Checkbox\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezboolean' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_boolean' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Country:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Country\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezcountry' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_country' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Date:
arguments:
$fieldType: '@Ibexa\Core\FieldType\Date\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezdate' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_date' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\DateAndTime:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\Date'
arguments:
$fieldType: '@Ibexa\Core\FieldType\DateAndTime\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezdatetime' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_datetime' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Float:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Float\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezfloat' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_float' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Email:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\EmailAddress\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezemail' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_email' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Image:
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezimage' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_image' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Integer:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Integer\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezinteger' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_integer' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\ISBN:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\ISBN\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezisbn' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_isbn' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Keyword:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Keyword\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezkeyword' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_keyword' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\MapLocation:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\MapLocation\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezgmaplocation' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_gmap_location' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Media:
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezmedia' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_media' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Relation:
arguments:
$fieldType: '@Ibexa\Core\FieldType\Relation\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezobjectrelation' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_object_relation' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\RelationList:
arguments:
$fieldType: '@Ibexa\Core\FieldType\RelationList\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezobjectrelationlist' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_object_relation_list' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText:
arguments:
$inputConverters:
html: '@Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\HtmlRichTextConverter'
markdown: '@Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\MarkdownRichTextConverter'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezrichtext' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_richtext' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\HtmlRichTextConverter:
arguments:
Expand All @@ -135,25 +135,25 @@ services:
arguments:
$fieldType: '@Ibexa\Core\FieldType\Selection\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezselection' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_selection' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\TextBlock:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\TextBlock\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'eztext' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_text' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\TextLine:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\TextLine\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezstring' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_string' }

Ibexa\GraphQL\Mutation\InputHandler\FieldType\Url:
class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash'
arguments:
$fieldType: '@Ibexa\Core\FieldType\Url\Type'
tags:
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezurl' }
- { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_url' }
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/services/resolvers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ services:
Ibexa\GraphQL\Resolver\ImageFieldResolver:
arguments:
$imageFieldType: '@Ibexa\Core\FieldType\Image\Type'
$variationHandler: '@ibexa.field_type.ezimage.variation_service'
$variationHandler: '@ibexa.field_type.ibexa_image.variation_service'
$contentService: '@ibexa.siteaccessaware.service.content'
tags:
- { name: overblog_graphql.query, alias: "ImageVariations", method: "resolveImageVariations" }
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Mutation/InputHandler/FieldType/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function toFieldValue($input, $inputFormat = null): Value
}

if (!in_array($inputFormat, ['timestring', 'rfc850', 'timestamp'])) {
throw new UnsupportedFieldInputFormatException('ezdate', $inputFormat);
throw new UnsupportedFieldInputFormatException('ibexa_date', $inputFormat);
}

return parent::toFieldValue(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Mutation/InputHandler/FieldType/RichText.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function toFieldValue($input, $inputFormat = null): Value
$this->inputConverters[$inputFormat]->convertToXml($input)
);
} else {
throw new UnsupportedFieldInputFormatException('ezrichtext', $inputFormat);
throw new UnsupportedFieldInputFormatException('ibexa_richtext', $inputFormat);
}

return $fieldValue;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Mutation/UploadFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ private function createContent(array $mapping, UploadedFile $file, int $location

$fieldDefinition = $contentType->getFieldDefinition($mapping['contentFieldIdentifier']);
switch ($fieldDefinition->fieldTypeIdentifier) {
case 'ezimage':
case 'ibexa_image':
$valueType = FieldType\Image\Value::class;
break;
case 'ezbinaryfile':
case 'ibexa_binaryfile':
$valueType = FieldType\BinaryFile\Value::class;
break;
case 'ezmedia':
case 'ibexa_media':
$valueType = FieldType\Media\Value::class;
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): ?stri

protected function canMap(FieldDefinition $fieldDefinition): bool
{
return in_array($fieldDefinition->fieldTypeIdentifier, ['ezobjectrelation', 'ezobjectrelationlist']);
return in_array($fieldDefinition->fieldTypeIdentifier, ['ibexa_object_relation', 'ibexa_object_relation_list']);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): ?stri

protected function getFieldTypeIdentifier(): string
{
return 'ezselection';
return 'ibexa_selection';
}
}
Loading