Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined ('_JEXEC') or die('resticted aceess');
- JLoader::register('JHtmlString', JPATH_LIBRARIES.'/joomla/html/html/string.php');
- //Load Helix
- $helix3_path = JPATH_PLUGINS.'/system/helix3/core/helix3.php';
- //Add js
- if (file_exists($helix3_path)) {
- require_once($helix3_path);
- helix3::addJS('jquery.nanoscroller.js'); // JS Files
- }
- AddonParser::addAddon('sp_newedge_slider','sp_newedge_slider_addon');
- // Required pagebuilder article helper
- require_once JPATH_COMPONENT . '/helpers/articles.php';
- function sp_newedge_slider_addon($atts){
- extract(spAddonAtts(array(
- "title" => '',
- "heading_selector" => 'h3',
- "title_fontsize" => '',
- "title_text_color" => '',
- "title_margin_top" => '',
- "title_margin_bottom" => '',
- "item_limit" => '',
- "theme" => 'img_overlay',
- "arrows" => 0,
- "order_by" => 'featured',
- "intro_text_limit" => '100',
- "column_no" => '3',
- "category" => '',
- "cat_rand_color" => 1,
- "class" => '',
- ), $atts));
- // Get Items from helper
- $items = SppagebuilderHelperArticles::getArticles($item_limit, $order_by, $category);
- // Start Slider
- $output ='<div class="sppb-addon sppb-addon-newedge-slider ' . $class . ' '. $theme . '">';
- $output .='<div class="sppb-addon-newedge-slider-content">';
- $output .='<div id="sppb-slider2-carousel" class="carousel slide" data-ride="carousel">';
- // start slider2
- // generate random color and insert into array
- foreach ($items as $key => $itemColor) {
- // rand color generate
- $itemColor->rand_color ='';
- $cat_icon_colors = array('#ed1c24', '#f26522', '#2e3192', '#00c8ff', '#ed145b', '#0072bc', '#0076a3', '#00a651', '#8dc63f', '#662d91');
- $rand_color = $cat_icon_colors[array_rand($cat_icon_colors)];
- if ($cat_rand_color) {
- $itemColor->rand_color = 'style="background-color: ' . $rand_color . ';"';
- }
- }
- // start carousel-indicators
- if ($theme == 'img_overlay') {
- $output .='<div class="container">';
- $output .='<div class="slider2-carousel-indicators nano">';
- $output .='<ul class="slider2-carousel-indicators-inner carousel-indicators nano-content" tabindex="0">';
- foreach ($items as $key => $panelItem) {
- $itemactive = ($key == 0) ? 'active' : '' ;
- $output .='<li data-target="#sppb-slider2-carousel" data-slide-to="' . $key .'" class="text-right ' . $itemactive . '">';
- $output .='<p class="slide2-type"> <span class="spns-cat-icon" ' . $panelItem->rand_color . '> ' . $panelItem->category[0]. '</span>' . $panelItem->category . '</p><h4 class="indicators-title"> ' . $panelItem->title . ' </h4>';
- $output .='</li>';
- }
- $output .='</ul>';
- $output .='</div>'; //.slider2-carousel-indicators
- $output .='</div>'; //.container
- // end carousel-indicators
- }
- $output .='<div class="carousel-inner" role="listbox">';
- foreach ($items as $key => $item) {
- $itemactive = ($key == 0) ? 'active' : '' ;
- $item->cat_link = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
- if (isset($item->featured_image) && $item->featured_image) {
- $image = $item->image_large;
- }else{
- $image = $images->image_intro;
- }
- // start each item
- $output .='<div class="item ' . $itemactive . '" style="background-image: url(' . $image . ');">';
- $output .='<div class="item-overlay"> </div>'; //.item-overlay
- $output .='<div class="container">';
- $output .='<div class="row">';
- $output .='<div class="col-md-6 col-sm-7 col-xs-12 next-post">';
- $output .='<div class="next-post-wrapper">';
- $output .='<div>';
- $output .='<a href="' . $item->cat_link . '">';
- $output .='<p class="spns-slide-cat"><span class="spns-cat-icon" ' . $item->rand_color . '> ' . trim($item->category)[0]. '</span>' . $item->category . '</p>';
- $output .='</a>';
- $output .='<a href="' . $item->link . '">';
- $output .='<h1 class="spns-slide-title">' . $item->title . '</h1>';
- $output .='</a>';
- $output .='</div>';
- $output .='</div>'; //next-post-wrapper
- $output .='</div>'; //.col-md-6 col-sm-8
- $output .='</div>'; //.row
- $output .='</div>'; //.container
- $output .='</div>'; // .item
- } // END:: foreach
- $output .='</div>'; //.carousel-inner
- if ($arrows) {
- // Navigation
- $output .='<div class="container custom-nav-wrap">';
- $output .= '<div class="customNavigation carousel-controls">';
- $output .= '<a class="left rank-control" data-target="#sppb-slider2-carousel" role="button" data-slide="prev">';
- $output .= '<i class="fa fa-angle-left"></i>';
- $output .= '</a>';
- $output .= '<a class="right rank-control" data-target="#sppb-slider2-carousel" role="button" data-slide="next">';
- $output .= '<i class="fa fa-angle-right"></i>';
- $output .= '</a>';
- $output .= '</div>'; //.customNavigation
- $output .= '</div>'; //.container
- } // END:: array
- $output .='</div>'; // end slider2
- $output .= '</div>'; //sppb-addon-newedge-slider-content
- $output .= '</div>'; //sppb-addon-newedge-slider
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment