-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mkdok/main
feat: Add min/max Grade fields for Session node
- Loading branch information
Showing
8 changed files
with
232 additions
and
82 deletions.
There are no files selected for viewing
174 changes: 92 additions & 82 deletions
174
config/install/core.entity_form_display.node.session.default.yml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
config/install/field.field.node.session.field_session_max_grade.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- field.storage.node.field_session_max_grade | ||
- node.type.session | ||
module: | ||
- options | ||
id: node.session.field_session_max_grade | ||
field_name: field_session_max_grade | ||
entity_type: node | ||
bundle: session | ||
label: 'Max Grade' | ||
description: 'Select List with maximum Grade option.' | ||
required: false | ||
translatable: false | ||
default_value: { } | ||
default_value_callback: '' | ||
settings: { } | ||
field_type: list_string |
20 changes: 20 additions & 0 deletions
20
config/install/field.field.node.session.field_session_min_grade.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- field.storage.node.field_session_min_grade | ||
- node.type.session | ||
module: | ||
- options | ||
id: node.session.field_session_min_grade | ||
field_name: field_session_min_grade | ||
entity_type: node | ||
bundle: session | ||
label: 'Min Grade' | ||
description: 'Select List with minimum Grade options.' | ||
required: false | ||
translatable: false | ||
default_value: { } | ||
default_value_callback: '' | ||
settings: { } | ||
field_type: list_string |
20 changes: 20 additions & 0 deletions
20
config/install/field.storage.node.field_session_max_grade.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- node | ||
- options | ||
id: node.field_session_max_grade | ||
field_name: field_session_max_grade | ||
entity_type: node | ||
type: list_string | ||
settings: | ||
allowed_values: { } | ||
allowed_values_function: '\Drupal\openy_node_session\SessionGrade::getGrades' | ||
module: options | ||
locked: false | ||
cardinality: 1 | ||
translatable: true | ||
indexes: { } | ||
persist_with_no_fields: false | ||
custom_storage: false |
20 changes: 20 additions & 0 deletions
20
config/install/field.storage.node.field_session_min_grade.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- node | ||
- options | ||
id: node.field_session_min_grade | ||
field_name: field_session_min_grade | ||
entity_type: node | ||
type: list_string | ||
settings: | ||
allowed_values: { } | ||
allowed_values_function: '\Drupal\openy_node_session\SessionGrade::getGrades' | ||
module: options | ||
locked: false | ||
cardinality: 1 | ||
translatable: true | ||
indexes: { } | ||
persist_with_no_fields: false | ||
custom_storage: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Drupal\openy_node_session; | ||
|
||
use Drupal\Core\StringTranslation\TranslatableMarkup; | ||
|
||
/** | ||
* Provides logic for listing session's grade types. | ||
*/ | ||
final class SessionGrade { | ||
|
||
/** | ||
* Gets the list of all available session's grade types. | ||
* | ||
* @return array | ||
* The labels, keyed by ID. | ||
*/ | ||
public static function getGrades() : array { | ||
return [ | ||
'PRE_K' => new TranslatableMarkup('Pre K'), | ||
'K' => new TranslatableMarkup('Kindergarten'), | ||
'1' => new TranslatableMarkup('Grade 1'), | ||
'2' => new TranslatableMarkup('Grade 2'), | ||
'3' => new TranslatableMarkup('Grade 3'), | ||
'4' => new TranslatableMarkup('Grade 4'), | ||
'5' => new TranslatableMarkup('Grade 5'), | ||
'6' => new TranslatableMarkup('Grade 6'), | ||
'7' => new TranslatableMarkup('Grade 7'), | ||
'8' => new TranslatableMarkup('Grade 8'), | ||
'9' => new TranslatableMarkup('Grade 9'), | ||
'10' => new TranslatableMarkup('Grade 10'), | ||
'11' => new TranslatableMarkup('Grade 11'), | ||
'12' => new TranslatableMarkup('Grade 12'), | ||
]; | ||
} | ||
|
||
} |