What the module does?

Add Child Page is a simple module that allows users to add a child page to the current page. It does it by adding an extra tab on selected content types, the user is then redirected to the node add form page with the parent menu already selected.

There's a configuration page to select on which content types the tab should show as well as a permission to set which user roles should have access to that functionality.

Configuration

In order to select the content types that would have this functionality enabled, the configuration page is on /admin/config/content/add-child-page and there's a permission for users to use this functionality.

Project link

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

Git instructions

git clone --branch '2.x' https://git.drupalcode.org/project/add_child_page.git

PAReview Link:

http://pareview.net/r/485

Comments

bbombachini created an issue. See original summary.

bbombachini’s picture

Status: Active » Needs review
bbombachini’s picture

Title: [D8] Add Child Page » [D9] Add Child Page
rajeshreeputra’s picture

Issue summary: View changes
Status: Needs review » Needs work

added pareview link: http://pareview.net/r/485
please see below PAReview issue, also looking into other files for Drupal code standards.

/src/Form/AddChildPageConfigurationForm.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------
88 | WARNING | Only string literals should be passed to t() where
| | possible
--------------------------------------------------------------------------

README.md
-----------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
-----------------------------------------------------------------------
7 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
17 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
28 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
38 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
40 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
42 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
43 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
48 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------
avpaderno’s picture

    foreach ($entity_bundles as $bundle => $bundle_info) {
      $content_types[$bundle] = $this->t($bundle_info['label']);
    }

There is no need to translate the bundle label, as $bundle_info['label'] already contains the translation, if it exists.

bbombachini’s picture

I've updated the module with the suggested changes. Thank you @apaderno and @rajeshreeputra for the review.
Here's the PAReview link after the code update: http://pareview.net/r/494

bbombachini’s picture

rajeshreeputra’s picture

@bbombachini, when you are done with changes please update the status to "Need Review".

bbombachini’s picture

Status: Needs work » Needs review
rohitrajputsahab’s picture

Status: Needs review » Needs work

@bbombachini

I have found something. Please check the point below.

1. Please provide config form link in info.yml file.
2. Don't use
$this->messenger()->addMessage($this
->t('The configuration options have been saved.'));

Use this
return parent::submitForm($form, $form_state);

bbombachini’s picture

Fixed @rohit-rajput-sahab, thanks for the review!
At the time of this writing https://pareview.net/ is down, so I'll try tomorrow again but I'm moving to needs review as it's ready to review.

bbombachini’s picture

Status: Needs work » Needs review
rohitrajputsahab’s picture

Status: Needs review » Needs work

FILE: /var/www/html/add_child_page/add_child_page.info.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
9 | ERROR | [x] Expected 1 newline at end of file; 0 found

Please fix this

avpaderno’s picture

Status: Needs work » Needs review

If that is the only reported error, it's not an application stopper.

califken’s picture

Status: Needs review » Needs work

I was able to add a child page to content, however, I was receiving the following error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'token_node_menu_link_submit' not found or invalid function name in Drupal\Core\Entity\EntityForm->buildEntity() (line 299 of /var/www/html/d2/d2/web/core/lib/Drupal/Core/Entity/EntityForm.php).

Once I had enabled the token module, the error no longer occurs. You may want to add the token module as a dependency?

bbombachini’s picture

Status: Needs work » Needs review

Good catch @califken, as I usually have token on all sites I work with, this went unnoticed. Thank you!
Added token dependency, sending back to needs review.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

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.