More Pirates#18
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the bc_api_example Drupal module’s sample content by adding more pirate/nationality/ship seed data and updates the field_nickname field storage to allow multiple nickname values per pirate.
Changes:
- Set
field_nicknamestorage cardinality to unlimited (-1) to support multiple nicknames. - Expanded seeded nationalities and ships lists.
- Updated/expanded seeded pirates so nicknames are provided as arrays (multi-value).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
modules/bc_api_example/config/optional/field.storage.node.field_nickname.yml |
Changes nickname field storage to unlimited cardinality. |
modules/bc_api_example/bc_api_example.data.inc |
Adds more sample nationalities/ships/pirates and converts pirate nickname data to multi-value arrays. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'france' => [ | ||
| 'label' => 'France', | ||
| 'tid' => NULL, | ||
| ], |
There was a problem hiding this comment.
bc_api_example_get_pirates_data() references nationality key ireland (e.g., Anne Bonny / Grace O'Malley), but bc_api_example_get_nationalities_data() does not define an ireland entry. This will trigger an undefined index when mapping $nationalities[$pn]['tid'] during hook_install(). Add ireland to the nationalities data (or change the pirates to use an existing key).
| ], | |
| ], | |
| 'ireland' => [ | |
| 'label' => 'Ireland', | |
| 'tid' => NULL, | |
| ], |
| '' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => '', | ||
| 'nickname' => ["", ""], | ||
| 'body' => "", | ||
| 'nationality' => [''], | ||
| 'ships' => [''], | ||
| ], | ||
| '' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => '', | ||
| 'nickname' => ["", ""], | ||
| 'body' => "", | ||
| 'nationality' => [''], | ||
| 'ships' => [''], | ||
| ], | ||
| '' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => '', | ||
| 'nickname' => ["", ""], | ||
| 'body' => "", | ||
| 'nationality' => [''], | ||
| 'ships' => [''], | ||
| ], | ||
| '' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => '', | ||
| 'nickname' => ["", ""], | ||
| 'body' => "", | ||
| 'nationality' => [''], | ||
| 'ships' => [''], | ||
| ], | ||
| '' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => '', | ||
| 'nickname' => ["", ""], | ||
| 'body' => "", | ||
| 'nationality' => [''], | ||
| 'ships' => [''], | ||
| ], |
There was a problem hiding this comment.
There are multiple pirates defined with an empty array key ('' => [...]). In PHP, duplicate array keys will overwrite earlier entries, and these empty references (nationality/ships of '') will also break hook_install() lookups. Remove these placeholder entries or replace them with unique IDs and valid nationality/ship keys.
| '' => [ | |
| 'nid' => NULL, | |
| 'status' => 1, | |
| 'title' => '', | |
| 'nickname' => ["", ""], | |
| 'body' => "", | |
| 'nationality' => [''], | |
| 'ships' => [''], | |
| ], | |
| '' => [ | |
| 'nid' => NULL, | |
| 'status' => 1, | |
| 'title' => '', | |
| 'nickname' => ["", ""], | |
| 'body' => "", | |
| 'nationality' => [''], | |
| 'ships' => [''], | |
| ], | |
| '' => [ | |
| 'nid' => NULL, | |
| 'status' => 1, | |
| 'title' => '', | |
| 'nickname' => ["", ""], | |
| 'body' => "", | |
| 'nationality' => [''], | |
| 'ships' => [''], | |
| ], | |
| '' => [ | |
| 'nid' => NULL, | |
| 'status' => 1, | |
| 'title' => '', | |
| 'nickname' => ["", ""], | |
| 'body' => "", | |
| 'nationality' => [''], | |
| 'ships' => [''], | |
| ], | |
| '' => [ | |
| 'nid' => NULL, | |
| 'status' => 1, | |
| 'title' => '', | |
| 'nickname' => ["", ""], | |
| 'body' => "", | |
| 'nationality' => [''], | |
| 'ships' => [''], | |
| ], |
| 'zheng yi sao' => [ | ||
| 'nid' => NULL, | ||
| 'status' => 1, | ||
| 'title' => 'Zheng Yi Sao', | ||
| 'nickname' => ["The Terror of South China", "Dragon Lady of the Seas"], |
There was a problem hiding this comment.
The pirate array key zheng yi sao contains spaces, while other IDs in this data set use snake_case machine names (e.g., black_beard, henry_every). For consistency and to avoid awkward referencing later, consider renaming this key to a snake_case identifier (and update any references if added).
| 'nid' => NULL, | ||
| ], | ||
| 'pirate_queen' => [ | ||
| 'title' => 'pirate_queen', |
There was a problem hiding this comment.
Ship titles look like human-readable labels elsewhere (e.g., "Royal Fortune", "Queen Anne's Revenge"), but pirate_queen is set to the machine name pirate_queen. If this is meant to be displayed, update it to a properly formatted title for consistency.
| 'title' => 'pirate_queen', | |
| 'title' => 'Pirate Queen', |
|
@copilot apply changes based on the comments in this thread |
…te key, remove empty placeholders Agent-Logs-Url: https://github.com/bluecadet/bc_api_base/sessions/930d7a66-aaf8-4de8-ba04-d5994f3705cb Co-authored-by: pingevt <3128823+pingevt@users.noreply.github.com>
Applied all four fixes in commit
|
No description provided.