Skip to content

Commit

Permalink
Issue #2809 - News Carousel option.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Oct 10, 2017
1 parent 8b32e67 commit fb96f74
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions e107_core/shortcodes/batch/news_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,41 @@ public function sc_news_image($parm=null)
return $this->sc_newsimage($parm);
}

private function news_carousel($parm)
{
if(empty($this->news_item['news_thumbnail']))
{
return null;
}

$options = $parm;

if(!isset($options['interval']))
{
$options['interval'] = 'false';
}


$tp = e107::getParser();

$media = explode(",", $this->news_item['news_thumbnail']);
$images = array();

foreach($media as $file)
{
if($tp->isVideo($file) || empty($file))
{
continue;
}

$images[] = array('caption'=>'', 'text'=> $tp->toImage($file,$parm));
}

// return print_a($images,true);

return e107::getForm()->carousel('news-carousel-'.$this->news_item['news_id'],$images, $options);
}

public function sc_news_related($parm=null)
{
return $this->sc_newsrelated($parm);
Expand Down Expand Up @@ -841,6 +876,11 @@ function handleMultiple($parm,$type='image')
*/
function sc_newsimage($parm = null)
{
if(!empty($parm['carousel']))
{
return $this->news_carousel($parm);
}

$tp = e107::getParser();

if(is_string($parm))
Expand Down
2 changes: 1 addition & 1 deletion e107_handlers/form_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ function tabs($array,$options = array())
* @param string $name : A unique name
* @param array $array
* @param array $options : default, interval, pause, wrap
* @return string
* @return string|array
* @example
* $array = array(
* 'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ),
Expand Down

0 comments on commit fb96f74

Please sign in to comment.