This is a very simple Drupal 8 module to override the default node create, update, and delete form titles and button labels.

Often times when building a Drupal site I find myself using hook_form_alter to change the page titles and button labels based on certain conditions for that content type. This module aims to make that easier by putting some of these common overrides in the config of the content type using thirdPartySettings and supports tokens.

Although I have been using Drupal for many years this is my first contributed module. I hope I got all the application steps correct. Thanks!

Project link

https://www.drupal.org/project/node_form_overrides

Git instructions

git clone --branch 1.0.x https://git.drupalcode.org/project/node_form_overrides.git

CommentFileSizeAuthor
node_form_override_screenshot.png81.76 KBloze

Comments

loze created an issue. See original summary.

loze’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

smustgrave’s picture

Status: Needs review » Needs work

Automated Review

[Best practice issues identified by pareview.sh / drupalcs / coder.

Found
Returned this Deprecated function: Function Redis::delete() is deprecated in Redis_Lock_PhpRedis->lockRelease() (line 111 of /var/vhosts/c214000000/site1101/web/public/sites/all/modules/contrib/redis/lib/Redis/Lock/PhpRedis.php).

Manual Review

I ran a code check locally and got the following

FILE: /app/wwwroot/modules/custom/node_form_overrides/node_form_overrides.info.yml
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically (Drupal.InfoFiles.AutoAddedKeys.Project)
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically (Drupal.InfoFiles.AutoAddedKeys.Timestamp)
 1 | WARNING | "core_version_requirement" property is missing in the info.yml file
   |         | (DrupalPractice.InfoFiles.CoreVersionRequirement.CoreVersionRequirement)
------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /app/wwwroot/modules/custom/node_form_overrides/node_form_overrides.module
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 11 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
  39 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  47 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  52 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  57 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  63 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  70 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
  76 | ERROR   | [x] Short array syntax must be used to define arrays (Drupal.Arrays.DisallowLongArraySyntax.Found)
 141 | ERROR   | [x] Expected 1 space after IF keyword; 0 found (Drupal.ControlStructures.ControlSignature.SpaceAfterKeyword)
 141 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
     |         |     (Drupal.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis)
 148 | WARNING | [ ] Only string literals should be passed to t() where possible (Drupal.Semantics.FunctionT.NotLiteralString)
 155 | ERROR   | [x] Expected newline after closing brace (Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace)
 157 | WARNING | [ ] Only string literals should be passed to t() where possible (Drupal.Semantics.FunctionT.NotLiteralString)

The README.txt file just lists the modules name. Would follow guidelines for in-project documentation and/or the README Template

There's no composer.json file where your license and any requirements would be.

The .info.yml file should have a core_version_requirement to specify if it's D9 ready. Also don't think you need '' around your dependencies anymore.

Haven't tested the functionality yet.

loze’s picture

Status: Needs work » Needs review

Thank you,
I've made the corrections and committed the code to the repository.

smustgrave’s picture

Status: Needs review » Needs work

Ran phpcs again and just one more error

FILE: ...b/modules/contrib/node_form_overrides/node_form_overrides.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 155 | ERROR | [x] Expected newline after closing brace
     |       |     (Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace)

Also in the .info file could you change the package name? Not a stopper I believe but that package may be specific to your project.

Also not a stopper but following the steps in your README "unser" believe is a misspell.
In the .modules file "lables" is misspelled.

Small things just wanted to point out.

Installed your module locally and functionally everything seems to install correctly.
Made changes to the labels and saw those being reflected so it appears to be working also. Not seeing any issues.

loze’s picture

Status: Needs work » Needs review

I've committed the requested updates. Thanks.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Everything looks good to me.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Reviewed & tested by the community » Fixed
Issue tags: -PAreview: project created less than ten days ago

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.