e107inc / bootstrap4

Bootstrap4 Theme folder working repo
1 stars 0 forks source link

shortcode menu #2

Closed Jimmi08 closed 5 years ago

Jimmi08 commented 5 years ago
<?php
/*
 * e107 website system
 *
 * Copyright (C) 2008-2016 e107 Inc (e107.org)
 * Released under the terms and conditions of the
 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
 *
 * jm_shortcode menu file.
 *
 */

if (!defined('e107_INIT')) { exit; }

$text = "";
/*               
if(!empty($parm))
{
  print_a($parm);

}   */       

if(isset($parm['shortcode_menuCaption'][e_LANGUAGE]))
{
    $caption = $parm['shortcode_menuCaption'][e_LANGUAGE];
}
else $caption = $parm['shortcode_menuCaption']; 

$text =  e107::getParser()->parseTemplate($parm['shortcode_menuCode']);
$style =  e107::getParser()->parseTemplate($parm['shortcode_menuTableStyle']); 
e107::getRender()->tablerender($caption, $text, $style );

?>
class jmtheme_menu
{
    function __construct()
    {
        // e107::lan('jm_shortcode','menu',true); // English_menu.php or {LANGUAGE}_menu.php
    }

    /**
     * Configuration Fields.
     * @return array
     */
    public function config($menu='')
    {

        $fields = array();
    switch($menu)
        {
            case "shortcode":

        $fields['shortcode_menuCaption']      = array('title'=> "Caption", 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
        $fields['shortcode_menuCode']         = array('title'=> "Shortcode code", 'type'=>'text', 'writeParms'=>array('size'=>'xxlarge'));
        $fields['shortcode_menuTableStyle']   = array('title'=> "ID for tablestyle", 'type'=>'text', 'writeParms'=>array('size'=>'xxlarge')); 
        return $fields;

    } 
    }

}
CaMer0n commented 5 years ago

Since this menu requires a knowledge of shortcodes and their parameters, I believe this would be best suited to a third-party plugin. Doesn't apply to this 'theme only' repo.

Jimmi08 commented 5 years ago

I disagree, but I can live with it.

Theme developer knows what shortcode they want to use in what menu area. This way they could prepare full demo content without dependency on the 3rd plugin.

This functionality should be in core or menu manager should be able to load menus from theme too.