Nodeinfo is a small and simple module that displays important, usually hidden information about currently viewed node for editors/administrators (permission configurable).

Nodeinfo (D7) screenshot

Of the shown information especially NID is very handy to know when for example content editing team wants to inform developers about an issue on a certain page. Displayed informational message allows easy way to copy the node's node/123 URL to clipboard. With a normal Drupal installation content editors may not know how to find the node's node/NID path they usually just copy path alias when sharing links internally -> this may cause 404's if alias changes and no redirect is created (very valid scenario during website development/staging).

Nodeinfo also displays the node changed date and tells if the node is sticky or promoted to homepage. Drupal 7 version integrates with domain access module informing user(s) about the domain(s) the node is published to.

I have not found similar modules from https://www.drupal.org/project/project_module and this has definitely been helpful small extension for our Drupal projects at work.

Project page: drupal.org/sandbox/kirkkala/2078927

Git (D8):
git clone --branch 8.x-1.x https://git.drupal.org/sandbox/kirkkala/2078927.git nodeinfo

Git (D7):
git clone --branch 7.x-1.x https://git.drupal.org/sandbox/kirkkala/2078927.git nodeinfo

Comments

kirkkala created an issue. See original summary.

kirkkala’s picture

Issue summary: View changes
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

kajalkiran’s picture

StatusFileSize
new141.62 KB
new179.59 KB
new84.59 KB
new126.87 KB

Hi @kirkkala,

I have reviewed your module. Following are the feedback for the same :

Automated Review

  • For Drupal 8 :
  • [No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.]

  • For Drupal 7:

D7_pa_error.png

Manual Review

Individual user account

Coding style & Drupal API usage

    List of identified issues:
  • Found issues after testing the module with coder module. Few minor errors :
  • coder issues

Recommendations for Application Issue

  • Provide Similar Modules and how your module is different from others.
  • As a developer I would have preferred creating a view block and place this block in the region as per my current theme. The view block select node nid from the contextual filter and provide the value from url.(contextual filter will be important to get the current nid of the viewed page) refer screenshot. Thus this block would be configurable and could be restricted for users on as per the role. As per the requirement more node information/ submission information could be added/removed to the view. This would be more configurable.
  • view

    recom.png

kajalkiran’s picture

Status: Needs review » Needs work
kirkkala’s picture

Issue summary: View changes
kirkkala’s picture

Thanks a lot @kajalkiran for your review. I've fixed pareview.sh errors from 7.x-1.x branch & made the main nodeinfo message fully translatable.

Your idea of showing nodeinfo in configurable view-block sounds nice but I don't really see much added value and keeping the module simple is the key here. Or if this really gets popular then later adding configurable alternative to show the info in configurable block.

Nodeinfo visibility is already configurable via Drupal permissions (view node info).

kirkkala’s picture

Status: Needs work » Needs review
harika gujjula’s picture

Hi kirkkala,

The module is working fine as mentioned in the description

It would be good if we have the hook_help for the module

https://www.drupal.org/docs/develop/documenting-your-project/module-docu...

kirkkala’s picture

Thank you harika gujjula for your review and good tip on missing hook_help(). I added that for both D7 & D8 branches.

ankush_03’s picture

Hi kirkkala,

I have review you d7 branch, please find below details :

Please add t() function on line 57 $pub_status = ' <em>unpublished</em> ';

Please add t() function on line 87 $ad .= ' <strong>Assigned to all domains</strong><br />';

Please add t() function on line 113 $ad .= $delimiter . '<em title="' . $domain['sitename'] . '">' . $pt . '</em>';

prashant114606’s picture

Status: Needs review » Needs work

Hi kirkkala,

In d8 no need to write the hook_permission inside .module file instead of that you can use modulename.permission.yml which you have already implement.

File:

nodeinfo.module

20

/**
 * Implements hook_permissions().
 */
function nodeinfo_permission() {
  return array(
    'view node info' => array(
      'title' => t('View node info'),
      'description' => t('Display node info message when viewing nodes.'),
    ),
  );
}

The above code looks like its not required. It is recommended to remove the above code.

kirkkala’s picture

agautam, thanks for review - D7 branch all strings are now ran through t(). The last one though I don't see any added value translating since all output comes from domain access configurations.

kirkkala’s picture

Status: Needs work » Needs review

prashant114606, thanks for the review. Indeed hook_permissions() is unnecessary with D8 - seems I just forgot it after running moduleupgrader.. Deleted from D8 branch,

jaykandari’s picture

Hi kirkkala,

Here is my review report about 8.x-1.x branch !! The overall code looks good. The only issue I found here is the length of code. While it's not mandatory to have a specific minimum code length. Kindly have a look at "guidelines for project length" page to get a general idea about how much code one should at least put in else it seems good to issue RTBC to this issue.

Thanks !! :)

Automated Review

Ran 8.x branch thru pareview.sh It showed no errors/warning: https://pareview.sh/node/664

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
No: Does not follow the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
Meets coding standards. Ran code thru phpcs. It returned no warnings/errors.

This review uses the Project Application Review Template.

aloknarwaria’s picture

Status: Needs review » Needs work

Hi

Please find the comments below

1. In your current, you have used the "hook_preprocess_page" hook as in drupal 8 the event subscriber is recommended.
It is recommended to use the eventsubsriber" for the same.

visabhishek’s picture

Status: Needs work » Needs review

These are surely not a application blockers, anything else that you found or should this be RTBC instead?

aloknarwaria’s picture

Status: Needs review » Reviewed & tested by the community

Hi @kirkkala,

The module is working fine for me, Please find my comment/suggestions on over the same.

1. It will be good if you can provide the edit on message.

2. Currently, you are using "drupal_set_message" function. This method have the \Drupal::service('page_cache_kill_switch')->trigger(); code, that does not all me to cache the pages.
So it's a suggestion if your module provides the block integration to display the messages then the cache issues is resolved.

3. Please try to avoid the unwanted hooks "hook_preprocess_page" as they may be deprecated in future drupal versions.

Otherwise, the module is working fine. Good work. :)

kirkkala’s picture

Status: Reviewed & tested by the community » Needs review

Thanks for the feedback. As suggested I removed hook_preprocess_page and use eventsubscriber instead (8.x-1.x only).

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpsgitdrupalorgsandboxkirkkala2078927git

I'm a robot and this is an automated message from Project Applications Scraper.

kirkkala’s picture

Status: Needs work » Needs review

Oops, fixed the few warnings though some "possible false positives" still left.. Appreciated if someone could guide how to fix and/or if even needed in this case?

DrupalPractice has found some issues with your code, but could be false positives.

FILE: ...root/repos/pareviewsh/pareview_temp/src/EventSubscriber/NodeInfo.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------
23 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
...
Entaro’s picture

Hello,

After reviewing Drupal 8 version of module I must say that I agree with @kajalkiran, creating a block that can be assigned to any region sound much better then displaying information about node using drupal_set_message(). In this case you could also avoid hooking into KernelEvents. This is only suggestion so decision is up to you.

In order to fix your problem with dependency injection you can pass additional arguments to your service, this is example how inject route_match, modify nodeinfo.services.yml

services:
  nodeinfo:
    class: 'Drupal\nodeinfo\EventSubscriber\NodeInfo'
    arguments: ['@current_route_match']
    tags:
      - {name: event_subscriber}

And then inside NodeInfo class define protected variable $routeMatch and initialise it inside constructor so you class looks something like this

/**
 * Class NodeInfo.
 */
class NodeInfo implements EventSubscriberInterface {

  /**
   * The current route match.
   *
   * @var \Drupal\Core\Routing\RouteMatchInterface
   */
  protected $routeMatch;

  /**
   * Constructs a TwitterEntityManager object.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   */
  public function __construct(RouteMatchInterface $route_match) {
    $this->routeMatch = $route_match;
  }

After you do it you can replace this code
$node = \Drupal::routeMatch()->getParameter('node');
with this one
$node = $this->routeMatch->getParameter('node');

narendrar’s picture

kirkkala’s picture

Assigned: Unassigned » kirkkala
Status: Needs review » Needs work

Thanks @entaro for your good example on dependency injection, I fixed all occurrences of \Drupal calls to fully pass CS.

Will work later to get a display of nodeinfo via block as suggested by already a few members. I guess it makes sense..

narendrar’s picture

Also , please check if this module is duplicate of https://www.drupal.org/project/about_this_node or not.
I have already created a port of drupal 8 and waiting for the maintainer to provide me access of project.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

avpaderno’s picture

Assigned: kirkkala » Unassigned