Advertisement
martawijaya

State Emitters

Aug 5th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.01 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Widget Name: FAQ Content
  5. Description: FAQ Content
  6. Author: IMM
  7. Author URI: https://islandmediamanagement.com
  8. */
  9.  
  10. class Faq_Content extends SiteOrigin_Widget {
  11.     function __construct() {
  12.  
  13.         parent::__construct(
  14.             'faq-content',
  15.             __( 'FAQ Content', 'imm-widget' ),
  16.             array(
  17.                 'description' => __( 'FAQ Content', 'imm-widget' ),
  18.         'panels_groups' => array('imm')
  19.             ),
  20.             array(),
  21.             false,
  22.             plugin_dir_path( __FILE__ )
  23.         );
  24.     }
  25.  
  26.     function initialize() {
  27.         $this->register_frontend_styles(
  28.                 array(
  29.                     array( 'faq-content', THEME_MODULES_URI . '/so-widgets/faq-content/assets/faq-content.css' )
  30.                 )
  31.         );
  32.  
  33.     $this->register_frontend_scripts(
  34.                 array(
  35.                     array( 'faq-content', THEME_MODULES_URI . '/so-widgets/faq-content/assets/faq-content.js' )
  36.                 )
  37.         );
  38.     }
  39.  
  40.   function enqueue_frontend_scripts( $instance ) {
  41.     // wp_enqueue_style('slick');
  42.     // wp_enqueue_script('slick');
  43.  
  44.     $this->enqueue_registered_scripts( $instance );
  45.     $this->enqueue_registered_styles( $instance );
  46.   }
  47.  
  48.     function get_widget_form() {
  49.     return array(
  50.       'beginning_content' => array(
  51.         'type' => 'tinymce',
  52.         'label' => __( 'beginning Content', 'imm-widget' ),
  53.       ),
  54.       'itinerary_repeater' => array(
  55.         'type' => 'repeater',
  56.         'label' => __( 'Testimonial repeater' , 'imm-widget' ),
  57.         'item_name'  => __( 'Testimonial item', 'imm-widget' ),
  58.         'item_label' => array(
  59.             'selector'     => "[id*='title_content']",
  60.             'update_event' => 'change',
  61.             'value_method' => 'val'
  62.         ),
  63.         'fields' => array(
  64.             'title_content' => array(
  65.                 'type' => 'text',
  66.                 'label' => __( 'Title Menu', 'imm-widget' ),
  67.                 'state_emitter' => array(
  68.                     'callback' => 'select',
  69.                     'args' => array( 'field_type_{$repeater}' ),
  70.                 )
  71.             ),
  72.             'content_text' => array(
  73.                 'type' => 'tinymce',
  74.                 'label' => __( 'Content Menu', 'imm-widget' ),
  75.                 'state_handler' => array(
  76.                     'map_type[interactive]' => array('hide'),
  77.                     'map_type[static]' => array('show'),
  78.                 ),
  79.             ),
  80.             'map_type'    => array(
  81.                 'type'    => 'radio',
  82.                 'default' => 'static',
  83.                 'label'   => __( 'Add Sub Item?', 'siteorigin-widgets' ),
  84.                 'state_emitter' => array(
  85.                     'callback' => 'select',
  86.                     'args' => array( 'map_type' )
  87.                 ),
  88.                 'options' => array(
  89.                     'interactive' => __( 'Yes', 'siteorigin-widgets' ),
  90.                     'static'      => __( 'No', 'siteorigin-widgets' ),
  91.                 )
  92.             ),
  93.             'sub_items' => array(
  94.                 'type' => 'repeater',
  95.                 'label' => __( 'Sub item', 'imm-widget' ),
  96.                 'item_name' => __( 'Item Name', 'imm-widget' ),
  97.                 'item_label' => array(
  98.                     'selector'     => "[id*='title_item']",
  99.                     'update_event' => 'change',
  100.                     'value_method' => 'val'
  101.                 ),
  102.                 'fields' => array(
  103.                     'title_item' => array(
  104.                         'type' => 'text',
  105.                         'label' => __( 'Title Item', 'imm-widget' ),
  106.                     ),
  107.                     'content_item' => array(
  108.                         'type' => 'tinymce',
  109.                         'label' => __( 'Content Menu', 'imm-widget' ),
  110.                     ),
  111.                 ),
  112.                 'state_handler' => array(
  113.                     'map_type[interactive]' => array('show'),
  114.                     'map_type[static]' => array('hide'),
  115.                 ),
  116.                 'label' => __( 'Sub Item', 'siteorigin-widgets' )
  117.             ),
  118.         )
  119.       )
  120.       );
  121.   }
  122.  
  123. }
  124.  
  125. siteorigin_widget_register( 'faq-content', __FILE__, 'Faq_Content' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement