1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-13 17:12:07 +02:00

Issue #2809 - News Carousel option.

This commit is contained in:
Cameron 2017-10-09 18:26:05 -07:00
parent 8b32e679c7
commit fb96f7480c
2 changed files with 41 additions and 1 deletions

View File

@ -370,6 +370,41 @@ class news_shortcodes extends e_shortcode
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);
@ -841,6 +876,11 @@ class news_shortcodes extends e_shortcode
*/
function sc_newsimage($parm = null)
{
if(!empty($parm['carousel']))
{
return $this->news_carousel($parm);
}
$tp = e107::getParser();
if(is_string($parm))

View File

@ -580,7 +580,7 @@ class e_form
* @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' ),