New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add field:base-override-create command #4929
Add field:base-override-create command #4929
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to look up what these were. "Allows base fields to be overridden on the bundle level.". I'm not sure this belongs in drush core. Its pretty exotic.
/** | ||
* Create a new base field override | ||
* | ||
* @command base-field:override-create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want this in the field: namespace so it groups with the others in help list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
It's a Drupal core feature so I thought it would be an added value here, but I understand your point. I use it regularly, for example to make base fields optional/required for certain bundles or to change labels/descriptions. If you think this doesn't belong in Drush core, feel free to close the MR. |
15309ed
to
e432413
Compare
584b281
to
35fb410
Compare
+ fix renamed traits + make entityType argument optional
This PR adds a command to create a base field override. It has already been used in multiple projects as part of the wmscaffold module and is in my opinion stable enough to be considered to be merged in Drush.
Remarks
AskBundleTrait
andValidateEntityTypeTrait
are also included in Add field:delete command #4926, Add field:info command #4928 and Add field:base-info command #4930.Test scenarios
./vendor/bin/drush bfoc
=> Not enough arguments (missing: "entityType")../vendor/bin/drush bfoc node
=> Asks for bundle./vendor/bin/drush bfoc node --no-interaction
=> The bundle argument is required../vendor/bin/drush bfoc node article
=> Asks for field name./vendor/bin/drush bfoc node article --no-interaction
=> The field-name option is required../vendor/bin/drush bfoc node article --no-interaction --field-name=title
=> Successfully created base field override 'title' on node with bundle 'article' (with existing values), if the field doesn't exist Base field with name 'some_name' does not exist on bundle 'article'../vendor/bin/drush bfoc node article --field-name=title --field-label="Better title" --is-required=0
=> Successfully created base field override 'title' on node with bundle 'article' (with passed values)TODO