Description

A small module that helps with nodes that could be seen as configuration. For example a news view. Instead of making a view with a page display with a fixed path, title, etc., you create a block display and configure a Functional Content item for it and enter a node id. This node then becomes the url, title, etc around this view. You browse to this node and the view will be displayed. This means that content editors can change the node (new title, new url, etc) without breaking the view. Also, if you use features for storing the view-configuration, these features won't be overwritten anymore because the title or url of the page changes.

This module is used in https://www.drupal.org/project/dvg

Project page

https://www.drupal.org/sandbox/spadxiii/2164153

Git

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/SpadXIII/2164153.git functional_content

Reviews

[D7] LinkEX
[D7] Double Slash Fix
[D7] Entityreference Select View Per Context

Comments

SpadXIII’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
SpadXIII’s picture

Issue summary: View changes

Fixed git url

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/httpgitdrupalorgsandboxSpadXIII2164153git

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

SpadXIII’s picture

The PA robot found some comment-'issues' and long lines, but gave the wrong link. The correct one is http://pareview.sh/pareview/httpgitdrupalorgsandboxspadxiii2164153git-7x-1x.

SpadXIII’s picture

Status: Needs work » Needs review

I just fixed the minor issues the PA Robot reported. Only doc comments, blank-line and the readme.txt 'issues'.

sendinblue’s picture

Assigned: Unassigned » sendinblue

For review by me

sendinblue’s picture

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

Manual Review

- Remove the packaging lines from the .info. These will be added when the module is published.
- All variables used in your module should be removed in hook_uninstall().
- You must use check_plain() in functional_content_admin_config() for example where you do '#title' => $view_info['view_label'] . ' - ' . $view_info['display_label'] (filter_xss() or filter_xss_admin() are alternatives to check_plain() if you want to allow some tags here). Same for all your #description values, you should apply check_plain() in functional_content_admin().

SpadXIII’s picture

Status: Needs work » Needs review
  • Removed the package from the .info
  • Added a hook_uninstall that removed all functional content variables. As these are dynamic (with a prefix) I had to do a db_select to collect all variables first.
  • Added check_plain's on the titles and descriptions

And back to needs review :)

naveenvalecha’s picture

Status: Needs review » Needs work

functional_content.install : module_load_include('module', 'functional_content'); Wrong syntax and No need to load module file here because you can call the functions defined in module file in any file.I found there is no usage of this.Is it ?

SpadXIII’s picture

Status: Needs work » Needs review

@naveenvalecha I changed the load function to be drupal_load. Should be the correct one now.
The module is already disabled, which makes drupal not load the .module anymore. When uninstalling the module, I need to load its .module so I can use the defines to remove the variables.

naveenvalecha’s picture

The module is already disabled, which makes drupal not load the .module anymore. When uninstalling the module, I need to load its .module so I can use the defines to remove the variables.

There is no need to load the module file because you are getting the variables directly from the variables table and removing them using the variable_del.
So I have not seen any use of the module load include.we should not use it at all.
This is not a release blocker but you should remove it.

Another thing that I have noticed that your commits are not linked with your drupal profile. See the git instructions properly https://www.drupal.org/project/2164153/git-instructions So that the commits will display on your user profile page.This will show your contribution on your profile as well.

SpadXIII’s picture

I'll do some tests with the include. Afaik. because the module is already disabled, the .module isn't loaded automatically anymore. I could also just create the defines in the .install as well and not do an include at all. A little bit of duplication, but might be better than loading the .module file.

ps. I fixed the correct emailaddress in my repository. Downside of using multiple computers... :)

davidam’s picture

Automated Review

Yes. You can check: http://pareview.sh/pareview/httpgitdrupalorgsandboxspadxiii2164153git

Manual Review

Individual user account

Yes. You can read https://www.drupal.org/node/272587

No duplication

I would like read your explanation about why is better this method to enable the block for a specified node id with the standard block settings.

Master Branch

Yes. You can check: https://www.drupal.org/node/1127732

Licensing

Yes. You can check: https://www.drupal.org/licensing/faq

3rd party code

It's ok, too: https://www.drupal.org/node/422996

Code long/complex enough for review

Yes. You can check: https://groups.drupal.org/node/195848

Secure Code

Yes, you can check
+ https://www.drupal.org/writing-secure-code

Coding style & Drupal API usage

In .info you must introduce entity_reference_autocomplete as dependency.

SpadXIII’s picture

@davidam quick reply to your questions:

explanation about why is better this method to enable the block for a specified node id with the standard block settings

You don't want to give your content editors (not site administrators) access to the block interface. You might add a role for a 'super editor' and give them access to the Functional Content node-settings. Then they can change nodes for certain views. They can editor those without breaking the site.
By using context and this module, you can create features with every setting available. The node-nid is then moved towards 'content' (differs per environment). Creating a custom module with a hook_update, you can create an empty node and set it as the correct Functional Content node.

introduce entity_reference_autocomplete as dependency

It's an optional dependency, so I can't just add is as a hard dependency. Functional Content works fine without it: it just shows simple input fields instead of an autocomplete field to select the node.

zeeshan_khan’s picture

Hi SpadXIII,

I tried to review your module by following your installation and configuration steps everything worked fine to me but at the end I couldn't find my view block on that node page, I followed these steps.

1. Create a view with a block display
2. Create a node and remember its node id
3. Go to the functional content settings
4. Enable the functional content for the view block you just created
5. Optionally have the module generate a context; enter the context name, tag
and select the region for the view block
6. Save the settings and go to the functional content nodes
7. Enter the node id from the node you created step 3
8. If you did generate the context, you're ready to go! Just browse to the node
you created in step 3 and see the marvelous view appear in the region you
selected!
If you did not choose to automatically generate the context, you can create
your own; just select the correct Functional Content-callback in the
Callback conditions, etc. - This step didn't work out

Any idea?

klausi’s picture

Assigned: Unassigned » patrickd
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Review of the 7.x-1.x branch (commit d226353):

  • 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.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. So you are storing your configuration int he variable table. That will not scale if you have many functional content node configured on your site, right? The whole variable table is loaded into memory on every single page request, so I would suggest to use your DB table.
  2. functional_content.api.php: functional_content_functional_content() should be hook_functional_content().
  3. functional_content_node_access(): why do you prevent node deletion here? Please add a comment.
  4. _functional_content_item_name(): doc block is wrong. What info required?
  5. functional_content__callback(): why do you need !arg(2) here? Please add a comment.
  6. functional_content_node_load(): why do you need to slow down global node loads by adding your stuff here? Can't you load the functional content stuff only when it is actually needed? Please add a comment.

But that a re not application blockers, otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to patrickd as he might have time to take a final look at this.

SpadXIII’s picture

1. Good suggestion, will fix that asap
2. Fixed
For the other items, I added or extended the comments

Thanks for the reviews!

SpadXIII’s picture

@zeeshan_khan almost forgot to reply to you. I think it's a caching thing in the Context Callback module; the context callbacks are cached and not directly visible. I'll investigate the Context Callback module to see if I can find a fix.

klausi’s picture

Assigned: patrickd » Unassigned
Status: Reviewed & tested by the community » Fixed

no objections for more than a week, so ...

Thanks for your contribution, SpadXIII!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, 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.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

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

apaderno’s picture