Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On a setup where I have a "slideshow creator" CCK field on a content-type, when I enter a list of images in the URL field, but leave the directory field, it creates a slideshow with all the files of the site.
The code responsible for this seems to be in theme_slideshow_creator_formatter_default()
// Check it there is images on the slideshow: it can be
// - direct list of images
// - local directory where several images are
if (!empty($ssc['#url']) or !empty($ssc['#dir'])) {
if ($urls = split("\n", $ssc['#url'])) {
while (list($index, $url) = each($urls)) {
$urls[$index] = 'img=|' . $url;
}
}
if ($dirs = split("\n", $ssc['#dir'])) {
while (list($index, $url) = each($dirs)) {
$dirs[$index] = 'dir=|' . $url;
}
}
[...]
In the above code, split("\n", $ssc['#dir']) will always return an array with an empty element, which then becomes "dir=|", who in turn fetches all the files in files/*
See attached patch (tested on the git master branch for 6.x).
Comment | File | Size | Author |
---|---|---|---|
slideshow_creator.patch | 1.47 KB | bgm |
Comments
Comment #1
rhouse CreditAttribution: rhouse commentedThanks Bgm, I'll test this out. Also, I have discovered that this feature doesn't work in the D7 version. I have created an issue #1268962: "CCK field" feature doesn't work in D7; Has been removed. to discuss this. You might want to have a say there.
Comment #2
rhouse CreditAttribution: rhouse commentedHi Bgm, I have uploaded your fix to git for inclusion in the next release, many thanks for solving that problem.