Skip to content

Commit

Permalink
Merge pull request #3 from justbetter/feature/fieldtype-optimisation
Browse files Browse the repository at this point in the history
Changed field type data
  • Loading branch information
kevinmeijer97 authored Jun 16, 2023
2 parents d6565b3 + ea09aa4 commit a32a116
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/Fieldtypes/Postcodeservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ class Postcodeservice extends Text
protected function configFieldItems(): array
{
$config = parent::configFieldItems();
$config['input_type']['default'] = $this->postcodeserviceDefaultFieldType;
$config['input_type']['options'] = $this->postcodeserviceFieldTypes;

$config['postcodeservice_type'] = [
'display' => __('Field type'),
'instructions' => __('Select the Postcodeservice field type'),
'type' => 'select',
'default' => $this->postcodeserviceDefaultFieldType,
'width' => 50,
'options' => $this->postcodeserviceFieldTypes
];

return $config;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Tags/PostcodeserviceTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function getPostcodeserviceFields(array $form): array
}

foreach ($form['fields'] as $field) {
if (!isset($field['input_type']) || !isset($field['handle']) || ($field['type'] ?? '') !== 'postcodeservice') {
if (!isset($field['input_type']) || !isset($field['handle']) || ($field['type'] ?? '') !== 'postcodeservice' || !isset($field['postcodeservice_type'])) {
continue;
}

$postcodeserviceFields[$field['input_type']] = $field['handle'];
$postcodeserviceFields[$field['postcodeservice_type']] = $field['handle'];
}

return $postcodeserviceFields;
Expand Down

0 comments on commit a32a116

Please sign in to comment.