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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | no-bundles-selection.png | 19.25 KB | imre.horjan |
| Content-type-plugin.png | 28.32 KB | roynilanjan | |
| Context-configuration.png | 56.82 KB | roynilanjan | |
| Context-Panel-Varient.png | 11.76 KB | roynilanjan |
Comments
Comment #1
imre.horjanReading 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.
Comment #2
imre.horjanFor 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:
Comment #3
imre.horjanIf 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 nullAnd 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
Comment #4
roynilanjan commentedFirst 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
Comment #5
roynilanjan commentedafter comply the suggested points code checked in the same branch as mentioned previously
Comment #6
klausimanual review:
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.
Comment #7
imre.horjanNice 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:
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:
(corrected)
Comment #7.0
imre.horjanadded sandbox link
Comment #8
roynilanjan commented@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.
Comment #9
roynilanjan commented@klausi -
Here 3 more reviews please note,
Comment #10
roynilanjan commentedNeeds review! as mentioned suggestion being implemented!
Comment #11
roynilanjan commentedPlease have a look & give your feed back I have complied the points you have mentioned before!
Comment #12
Anonymous (not verified) commentedManual 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:
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.
Comment #13
roynilanjan commentedThanks 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),
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!
Comment #14
roynilanjan commentedPlease have a look!
Changes have been made according to suggestion
Comment #15
imre.horjanHi 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.
Comment #16
roynilanjan commentedCan 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!
Comment #17
roynilanjan commentedHi Klausi,
Please have a look & let me know your view as I have done all of the points mentioned above!
Comment #18
klausiThe 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.
Comment #19
roynilanjan commentedThanks all of you for the review!
As far Klausi's suggestion I'll improve the use case & published
Comment #20.0
(not verified) commentedTo make use case more clear it's needed some modification in the description of project