The Media Nivo Slider Drupal 7 module provides Nivo Slider functionality to Media Galleries (http://drupal.org/project/media_gallery). This module provides the ability to take any media gallery and expose it's images as a Nivo Slider slideshow which is contained in a Drupal block. These Nivo Slider blocks allow you to easily add a slideshow to various pages and in various regions of your site.
The Nivo Slider blocks are individually customizable so each of your slideshows can have different transition effects, speeds, etc. In addition, since the Nivo Slider blocks are sourced from a media gallery, the ordering of images in the slideshow can easily be changed by simply re-ordering the media in the gallery. This also allows for strictly curated slideshows and the ability to easily have the same image be a part of multiple slideshows if desired.
In terms of potential module duplication there does exist a similar module, the 'Views Nivo Slider' module, that provides Nivo Slider functionality to Views. However, given the significant differences between Views and Media Gallery I don't believe the 'Media Nivo Slider' module duplicates the functionality of the 'Views Nivo Slider' module. While they both provide roughly the same output, the driving sources and use cases are significantly different.
Sandbox Project: http://drupal.org/sandbox/peronas/1268008
Git Repo: http://git.drupal.org/sandbox/peronas/1268008.git
Comments
Comment #1
peronas commentedComment #2
MGParisi commentedPlease check your Media Gallery Link, it is pointing to a page not found, and there is a number of media galleries.
Comment #3
peronas commentedWoops! Looks like I had it as '../projects/..' rather than just '../project/..'
All fixed now. Thanks!
Comment #4
MGParisi commentedI use views, and not media gallery. The Nivo Media Slider for views is (like most D7 Modules of this type) rather unstable. Hopefully we will get a more solid version soon! There are allot of sliders, even a doc page on them all, but most never got ported and the chances of porting is slight.
Comment #5
peronas commentedAgreed there are a good number of slider modules for Drupal.
I chose to build one using media gallery for the basis, rather than use the existing views one, for a few reasons:
- The interface for ordering/managing the contents of a slider is much more approachable using the drag and drop reordering and media browser interface than dealing with views and filters.
- Using media galleries for the source content meant you could more tightly control the media showing up in the slider without having to implement a dozen fields to filter on as you would in views. In the case of the media galleries you only add the media you want to show up in the slider and that's it.
Mainly I wanted a slider that was going to be easy to manage the content and also allow for creating multiple sliders without having to add extra filterable values to the content or have multiple cloned views to manage.
As for the stability, one of the reasons I am submitting this project is to hopefully open it up to more use cases and really make sure it's stable. I currently use this module in a few different places, including one live site, but submitting it and having it used in other environments/use cases will really help weed out any quirks.
Comment #6
MGParisi commentedI am browsing your code and I see your not using PDO.
Its pretty clear you know what your doing in PHP, your not using all of the Drupal API functions, but your using more then most "offical" 7.x modules I have seen. You have been patient and I would hate to see your enthusiasm diminished.
You are using watchdog and print_r in it, I cant say for certain, but I don't think you should be inserting $node variables into query directly as they MAY contain SQL injects. I think we need someone more experienced to review that aspect of it.
Comment #7
elc commented/engage super-pedantic-mode
git repository full of executable files
Changing file permission masks on Windows
couple of the files missing EOL
db_query Could be converted to using DB:TNG. Use of parameter in first query in .install file seems unnecessary? Parameter is a static string.
non-expanding strings surrounded by "double quotes" Use single quotes if the string doesn't need $variable expansion
.info file the listed files[] are supurfluous as neither file includes a class or interface
image_get_info($media->uri) - result be checked to ensure it's not FALSE or you're about to get a couple annoying of error messages about indexes being invalid
What happens on a multilingual field? Is it possible? Does it matter? Comment says you do it for simplicity but doesn't justify why it can do that.
indenting gone whacky in _media_nivo_slider_block_cleanup
The XSS potential I was looking at evaporated when the unfiltered input was passed to theme('image') or theme('image_style') instead of being used directly.
Fix all that up and prepare the git repository as you would for a release and it's pretty much ready to go.
Comment #8
MGParisi commentedWhen your able to publish, please also update http://drupal.org/node/418616
Thanks:)
Comment #9
peronas commentedThanks for the feedback! I will address the above mentioned issues and update this when it's ready for review again.
Comment #10
peronas commentedOk the above listed items should be addressed. Thanks again to both of you for taking the time to review this and give some feedback!
@ELC For the multilingual question I hopefully clarified the assumption comment some. The assumption came from the fact that the media_gallery_media field is locked and not multilingual by default. So I figured it was a safe bet to assume the field would not be multilingual, as the Media Gallery module does as well.
As a surface test I did unlock it and did do a translation for the field and everything still worked fine. That said I'm rather green when it comes to field translations so my surface test is unlikely to have the coverage to definitively say how things would function if the field were to be multilingual. Any pointers/direction on testing this further would be welcomed.
@MGParisi I appreciate you taking time to look through the code, if you see anything of note, aside from the already mentioned PDO, that could be replaced by using some of the core Drupal API functions the I'd be appreciative of the input. The more stuff I can get out of the core API means fewer custom things I have to maintain!
Comment #11
peronas commentedComment #12
elc commentedgit commits look great - in nice logical commits.
At the top of media_nivo_slider.module, you have this
require_once(dirname(__FILE__) . '/media_nivo_slider.fields.inc');This should use the API function module_load_include instead. Also, it should probably be included only when necessary? Surely it's only needed occasionally? Then again, looking at it, potentially not. Does fields core module pull in the fields.inc files when needed? Or is that only views.inc for the views module.
This seems a little hard coded - there is a Libraries API module available to take care of this for you. Use the 7.x-1.x version and the same instructions for D6.
I'll leave the req for a release branch for when you're ready to release, but you should understand the implications of the master branch when it comes to managing releases in a full project - Release naming conventions
Setting back to 'normal' since I should have done it on the last reply.
Comment #13
peronas commentedIt doesn't seem that I can only include the fields.inc file when needed, doing so results in no errors but I get empty selects and checkboxes without values. I tried to find some definitive documentation on this but was unable to do so, in looking at other modules, mainly Media and Media Galleries, including the fields.inc file in this way seems to be somewhat common.
I did look at using module_load_include for including the file but since it appears to have to be loaded in the global context, require_once is noted as the proper method due to the bootstrap requirement of module_load_include. So for now I'm going to leave this as is, at least until I can find some more concrete documentation on the preferred way of including this file.
For including the nivo slider libraries, I'll take a look at the libraries module a bit more in depth, in the short description it still seems that the user is required to have the library in 'sites/all/libraries', at least for the v1 version. At first glance it doesn't seem worth it to have an additional module dependency when it's still restricting it to a hard path. I did do a quick code skim and saw a bit about profiles though so it may be more flexible than the short description makes it seem.
Thanks for the info on the release naming conventions, I hadn't read through that yet and wasn't entirely clear on how the release branching worked once I got to the full project phase.
I'll update this again once I've sorted the libraries thing. Thanks again for taking the time to review this!
Comment #14
peronas commentedOk I went ahead and integrated the Libraries module as it does add support to allow for the library to be in profile or site specific folders as well so it's no longer restricted to just the 'sites/all/libraries' location. The module seems pretty light, and the I'm all for having a unified way of dealing with 3rd party libraries in various locations rather than implementing one off library location fields in an admin interface for each module that relies on an external library.
So marking this back to needs review to button up any last bits.
Thanks again!
Comment #15
MGParisi commentedJust make sure you have the libraries module as a requirement in your .info
If you do/did that then I say lets promote you:)
Comment #16
MGParisi commentedThis contributor will be an asset to the community, we are crazy not to allow him to promote his module as he has done more then most.
Comment #17
peronas commentedThanks MGParisi! I have indeed added libraries as a dependency in the .info file so things should be good to go!
Comment #18
elc commentedThe media module was ironically the module I looked at to see how it used module_load_includes ; I was a little disappointed to find they had the same thing.
The actual function module_load_include can only be used once drupal_get_path is working ... in terms of load order, I really would have expected most of Drupal to be completely bootstrapped by the time it starts loading sliders from fields loaded off nodes ;) Then I had to ponder if there was really a need to split it out into fields.inc.
BUT I have been told that if some big module like media is doing the same thing, then it can't be too detrimental. Of course, it may just be hanging onto its D6 roots too :P
And yes, this module and author are ready to move on.
Comment #19
gregglesThis looks like a great module and I'm glad to see from the discussion so far that there has been a lot of great collaboration to make the module better.
It appears you are working in the "master" branch in git. You should really be working in a version specific branch. Please see the documentation about release naming conventions and creating a branch in git.
Thanks for identifying the potential duplication with http://drupal.org/project/views_nivo_slider - it would be good to add a link to that module to your project page and describe how they are different.
Your .info file and .js files have windows line endings. Please fix these to be Unix style line endings.
For the
$slider_id = ctools_cleanstring(check_plain($node->title), array('separator' => '_', 'lower case' => TRUE));can you use drupal_html_class instead of the ctools and check_plain?I see also in the block info that you are using node titles to create the name of blocks:
$blocks[$nid]['info'] = t('Media Nivo Slider: !title', array('!title' => $title));This should use the @ placeholder instead of ! because the $title could contain javascript. The @ placeholder will filter the title using check_plain which should prevent xss.
Marking this back to needs work only for the block title issue. The rest are lower priority suggestions.
Comment #20
peronas commented@greggles Thanks for the feedback. I've created a specific version branch as well as cleaned up the line endings.
I also resolved the potential XSS concern as you noted and switched the ID generation to use drupal_html_class, gets rid of the additional ctools include that was being done so I'm all for that. In addition, since drupal_html_class only does dashes as separators, I updated the rest of the ID generation stuff to be consistent in using dashes for the slider ID.
Let me know if you see anything else of note!
Thanks!
Comment #21
gregglesThanks for your contribution, peronas! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
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.
Comment #22
peronas commentedGreat! Thanks everyone for taking the time to review the module and give feedback. I'll definitely look through the pending review list and see if I can return the favor to someone else.
Thanks again!
Comment #23.0
(not verified) commentedFixing Media Gallery project link.