From a single context it's possible to change dynamically content list of a page.
If the context is derived from Entity which provides e.g. Node,Taxonomy,Comments,User etc..
according to this administrator can change content list of a page(currently it's implemented on node for bundles & taxonomy for vocabulary)
Also in the future we can make a page on the basis of comment as a context because comment supports in a different bundle
(e.g. Article comments,Page comments etc..)

  • Contextual Entity List is a Ctools plugin consisting context and content type.
  • In a context area(page manager/panel variant ) we get an additional option in drop down is called "Entity Type".
  • Choose existing entity and corresponding bundle of that entity.
  • After adding that context for a particular entity & it's bundle(Currently for node & taxonomy) a content type plugin will be available under "widget" is called "Contextual Entity".
  • On the basis of the above configuration this page will be rendered with available nodes (of that bundle & entity) along with comments and comment form section

.

--------------------------------------------
1.Enable modules from Modules->Contextual Suite.
2.In a panel variant of a page in context->choose Entity Type from drop down.
3. From Content area -> widget-> Contextual Entity available.

Sandbox: http://drupal.org/sandbox/roynilanjan/1691800

Please have a look the,
git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/roynilanjan/1691800.git contextual_entity_list

Also please note there are few inputs in my review with other project applications. URLS are,

http://drupal.org/node/1699468
http://drupal.org/node/1700478
http://drupal.org/node/1682682
http://drupal.org/node/1799196

Comments

imre.horjan’s picture

Reading the description of your project, it seems to me that you like challenges. :)
I'm not sure that I understood it all for the first read (especially, what use case is it for exactly), but would really like to dig deeper into it, so I checkout your code soon, and start playing with it.

imre.horjan’s picture

For the first manual review of your code, I couldn't find any critical issues. I haven't tested your module yet, that will be the next step.
Could you please explain me why are you providing those < option > tags in JS. Don't you think that using an AJAX form would be a better idea?
My other question is, if it's necessary to use that JS provider, don't you think that using a more module specific menu callback is a good idea instead of 'bundles', eg. 'contextual-entity-list-bundles' ?
Actually I'm not using Panels for my projects, so not very familiar to it.

Otherwise, I've found some typographic mistakes in your comments.
Let me correct those, what can help your efforts:

This is a module file having register contetual plugin from this module file.
This is a module file having register contextual plugin from this module file.
$plugin takes the plugin defination.
$plugin takes the plugin definition.
Ajax-Call-back.
AJAX callback.
Context call back.
Context callback.
Context configuartion for entity type.
Context configuration for entity type.
imre.horjan’s picture

Status: Needs review » Needs work
StatusFileSize
new19.25 KB

If there is no bundle for an entity type (eg. there's no vocabularies in the system), the Bundle type selection remains the previous, (the HTTP response body is empty), and it throws the JS error:
Uncaught TypeError: Cannot read property 'length' of null
And you can not select other entities thereafter because of the above.

I suggest you to rewrite the form using an AJAX callback bound to the entity selector, replacing the whole form or the bundle selector part of it in your callback.
Here's a good explanation: http://drupal.org/node/752056

roynilanjan’s picture

Status: Needs work » Needs review

First of all thanks for review the code.

Previously I tried to implement #ajax(AJAX callback) with ctools API but ctools have wired trick for which direct ajax callback(which is basically system/ajax call) is not working. So instead of using direct ajax callback I use the #path of ajax framework & it's corresponding commands to interact with DOM. Seems to me is a better idea instead of use direct jquery ajax call.

Also comply suggestion of #2.

Please have a look & let me know

roynilanjan’s picture

Priority: Normal » Major
Issue tags: +PAreview: review bonus

after comply the suggested points code checked in the same branch as mentioned previously

klausi’s picture

Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

manual review:

  1. Project page is not very clear, what is the use case? See http://drupal.org/node/997024
  2. contextual_entity_list_menu(): why is the permission just "access content"? who should be able to retrieve data from that callback?

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

imre.horjan’s picture

Status: Reviewed & tested by the community » Needs work

Nice work.
Excuse me to change it's status back to needs work.

I understand, that you are integrating into a CTools modal, and maybe you can not use standard AJAX techniques. (I can't confirm nor refute)
My only notice is that it doesn't seem safe enough for the first sight:

  $options = '';
  $entity_options = _contextual_entity_list_entity_options($entity);
  foreach ($entity_options as $key => $value) {
    $options .= "<option value=$key>$value</option>";
  }

Direct variable injection into strings (especially output) are avoided in drupal code. In this case I think you should better use check_plain or filter_xss_admin, like:

    $options .= '<option value="' . check_plain($key) . '">' . filter_xss_admin($value) . '</option>';

(corrected)

imre.horjan’s picture

Issue summary: View changes

added sandbox link

roynilanjan’s picture

Status: Needs work » Reviewed & tested by the community

@klausi -
Thanks for your review!
According to your suggestion I have made the changes in the use case please have a look.
Yes - there should be a specific permission which can be accessible by administrator / authenticated user.
So I have added module specific permission because this callback participate in a ajax call(according ajax framework) from ctools
context plugin.

I'll make more 3 reviews as far your suggestion & apply for review bonus in next!

@imre-
Thanks one second for suggestion & tips.
I have made the changes you suggested & checked in the code in the same branch.

roynilanjan’s picture

roynilanjan’s picture

Status: Reviewed & tested by the community » Needs review

Needs review! as mentioned suggestion being implemented!

roynilanjan’s picture

Please have a look & give your feed back I have complied the points you have mentioned before!

Anonymous’s picture

Status: Needs review » Needs work

Manual review:

1. Reading the instructions for the module I couldn't really figure out what it's actually for so perhaps this could be a little clearer. After some trial and error I think I understand it a bit better (although correct me if I'm wrong) - essentially does this module allow you to create a list of entities within a panel along with pagination links?
If this is what the module is for then it's pretty similar to setting up a views page, is there anything I'm missing which would distinguish the two?

After enabling the module & adding the settings as per the README.txt I had the following errors:

Notice: Undefined index: config-page-number in contextual_entity_list_entity_list_content_type_pane_render() (line 32 of \themes\sites\all\modules\contextual_entity_list\plugins\content_types\entity_list_content_type_pane.inc).
Notice: Undefined offset: 0 in theme_pager() (line 331 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager() (line 337 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_first() (line 459 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_previous() (line 489 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_next() (line 528 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_next() (line 528 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_next() (line 529 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_next() (line 531 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_last() (line 564 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_last() (line 564 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager_last() (line 565 of \themes\includes\pager.inc).
Notice: Undefined offset: 0 in theme_pager() (line 359 of \themes\includes\pager.inc).

I guess this has something to do with the "Config number of items per page" field being left blank perhaps?

2. The description for the "Config number of items per page" needs to be more descriptive, "The stuff for Contextual Entity." doesn't really tell me what the field does - perhaps you could use "The number of entities to be displayed on each page"

3. The README.txt could use a little work, listing the dependencies of the module for example. Also perhaps look at http://drupal.org/node/447604 for some guidance.

Apart from the above points, once I had it all setup everything seemed to work nicely. The panel page displayed a list of content types along with pagination.

roynilanjan’s picture

Thanks so much for reviewing

Few clarification please note,

Main goal of the module dynamically listing the data(currently it's running for content type & taxonomy),

  • listing of nodes basis of node type
  • nodes on the basis of terms of taxonomy
  • comment list according to content type

Those above points can be acheived by changing the context of a page(from page manager context)
& the context is an Entity . So any time administrator can change the context of a page & according to this data listing will be changed.
Here the context is a combination of entity & its bundles.
In future we can implement view modes as well from context confiugation so that if it's a Content type entity then according to bundle view mode will be selected as well

Pagination configuration is implemented in the content type plugin

As you mentioned regarding view page
=> View doesn't have an option to change entity type after creating a view you can only change the bundle & it's relation ship,fields from existing view configuration

"Config number of items per page" may have some problem if it's blank. sure I'll checkit again!.
Also I'll take care of README file according to URL you have given!

roynilanjan’s picture

Status: Needs work » Needs review

Please have a look!
Changes have been made according to suggestion

imre.horjan’s picture

Hi roynilanjan!
I've checked the source code on the day you committed.
I saw that you made changes you mentioned, and changed the satus back to 'reviewed & tested by the community' such as klausi had previously.
I thought everything is fine and the status 'reviewed & tested by the community' is correct.

roynilanjan’s picture

Can you please check & let me know your suggestion as I have completed all the mention points in the issue.
Should I make it "Review & tested by community" as you made it earlier?
Please give your feed-back!

roynilanjan’s picture

Hi Klausi,

Please have a look & let me know your view as I have done all of the points mentioned above!

klausi’s picture

Status: Needs review » Fixed

The project page is still unclear. What is this module good for?

So imre.horjan also thinks this is RTBC, let's go ...

Thanks for your contribution, roynilanjan!

I updated your account to let you 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 get 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.

roynilanjan’s picture

Thanks all of you for the review!
As far Klausi's suggestion I'll improve the use case & published

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

Anonymous’s picture

Issue summary: View changes

To make use case more clear it's needed some modification in the description of project