Skip to content

Commit 3e61ce7

Browse files
Supports new Field UI field type categories.
1 parent 9e61beb commit 3e61ce7

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

isced_code.info.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: 'ISCED code field'
22
type: module
33
description: 'ISCED codes as select options'
4-
core_version_requirement: ^8 || ^9 || ^10
5-
package: 'EWP'
4+
core_version_requirement: ^9.5 || ^10
5+
package: 'Field types'
66
dependencies:
77
- drupal:field
88
- drupal:options

isced_code.module

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ function isced_code_help($route_name, RouteMatchInterface $route_match) {
2222
default:
2323
}
2424
}
25+
26+
/**
27+
* Implements hook_field_info_alter().
28+
*
29+
* @todo Remove once minimum version supported is at least 10.2.0.
30+
*/
31+
function isced_code_field_info_alter(array &$info): void {
32+
// Allow module to work with older versions of Drupal.
33+
if (\version_compare(\Drupal::VERSION, '10.1.9999', '<')) {
34+
$info['isced_code']['category'] = t("General");
35+
}
36+
}

src/Plugin/Field/FieldType/IscedCodeItem.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
* @FieldType(
1414
* id = "isced_code",
1515
* label = @Translation("ISCED code"),
16-
* description = @Translation("ISCED codes as select options"),
17-
* category = @Translation("EWP select options"),
16+
* description = {
17+
* @Translation("Values stored are predefined 4-digit text values"),
18+
* @Translation("For example, '0613' => '0613 Software and applications development and analysis'"),
19+
* },
20+
* category = "selection_list",
1821
* default_widget = "isced_code_default",
1922
* default_formatter = "isced_code_default",
2023
* )

0 commit comments

Comments
 (0)