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
Comments
Comment #2
bbombachiniComment #3
bbombachiniComment #4
rajeshreeputraadded pareview link: http://pareview.net/r/485
please see below PAReview issue, also looking into other files for Drupal code standards.
Comment #5
avpadernoThere is no need to translate the bundle label, as
$bundle_info['label']already contains the translation, if it exists.Comment #6
bbombachiniI'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
Comment #7
bbombachiniComment #8
rajeshreeputra@bbombachini, when you are done with changes please update the status to "Need Review".
Comment #9
bbombachiniComment #10
rohitrajputsahab commented@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);
Comment #11
bbombachiniFixed @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.
Comment #12
bbombachiniComment #13
rohitrajputsahab commentedFILE: /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
Comment #14
avpadernoIf that is the only reported error, it's not an application stopper.
Comment #15
califken commentedI 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?
Comment #16
bbombachiniGood 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.
Comment #17
avpadernoThank 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.