Skip to content
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

Merged
merged 10 commits into from Dec 17, 2021

Conversation

DieterHolvoet
Copy link
Contributor

@DieterHolvoet DieterHolvoet commented Dec 12, 2021

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

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

  • Add tests

Copy link
Member

@weitzman weitzman left a 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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@DieterHolvoet
Copy link
Contributor Author

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.

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.

@DieterHolvoet DieterHolvoet force-pushed the base-field-override-create branch 2 times, most recently from 15309ed to e432413 Compare December 16, 2021 09:55
@DieterHolvoet DieterHolvoet changed the title Add base-field-override:create command Add field:base-override-create command Dec 17, 2021
@weitzman weitzman merged commit 39b5de3 into drush-ops:11.x Dec 17, 2021
@DieterHolvoet DieterHolvoet deleted the base-field-override-create branch December 18, 2021 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants