* Slider HTML markup */ function nivo_slider_slider() { // Get all available slides $slides = variable_get('nivo_slider_banner_settings', array()); // Create an array to hold visible slides $visible_slides = array(); // Determine which slides should be visible foreach ($slides as $slide) { // Only display published slides if ($slide['published'] == TRUE) { // Convert path to lowercase. This allows comparison of the same path // with different case. Ex: /Page, /page, /PAGE. $pages = drupal_strtolower($slide['visibility']); // Convert the Drupal path to lowercase $path = drupal_strtolower(drupal_get_path_alias($_GET['q'])); // Compare the lowercase internal and lowercase path alias (if any). $page_match = drupal_match_path($path, $pages); if ($path != $_GET['q']) { $page_match = $page_match || drupal_match_path($_GET['q'], $pages); } // Add the slide if a match was found if ($page_match) { $visible_slides[] = $slide; } } } // Create a variable to hold the final slider output $output = ''; // Create a variable to hold any HTML captions $description_html = ''; foreach ($visible_slides as $slide => $settings) { if (isset($settings['description']['value']) && isset($settings['description']['format'])) { // Create a variable to hold the slide description $description = ''; // Set the slide description directly when using plain text otherwise create an // HTML caption if ($settings['description']['format'] == 'plain_text') { $description = $settings['description']['value']; } else { // WYSIWYG editors are often used with formats other than plain text // These editors often automatically add an empty paragraph
// even if no text has been entered which causes the Nivo Slider // jQuery Plugin to display an "empty" caption // To prevent this from happening, strip all HTML tags from the caption // and check to see that some actual text has been entered $description_text_only = strip_tags($settings['description']['value']); if (!empty($description_text_only)) { // Generate a unique anchor to reference the HTML caption $description = '#htmlcaption-' . $slide; // Create the HTML caption markup $html_caption = ''; $html_caption .= '