title: Wp bakery Nested element using class
body: <p>I working with nested elements wp bakery . i am trying uses classes and public function .</p>
  
  <p>But could not get it working . its not registering . I think its may be an issue because i used class . please find whats wrong with . i dont need a work around . i know how to work it with out  member functions. but i need to do it using member functions </p>
  
  <pre><code>                &lt;?php
              /*
               *  Element Description: Featured Block
               */
                  //featured block container
                  if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
                      class protechsaasFeaturedBlock extends WPBakeryShortCodesContainer {
  
                          // Element Init
                          function __construct() {
                              add_action( 'init', array( $this, 'protechsaas_featured_block_mapping' ) );
                              add_shortcode( 'feature_container', array( $this, 'protechsaas_featured_block_html' ) );
                          }
                          // Element Mapping
                          public function protechsaas_featured_block_mapping() {
  
                              // Stop all if VC is not enabled
                              if ( !defined( 'WPB_VC_VERSION' ) ) {
                                  return;
                              }
  
                               //Register "container" content element. It will hold all your inner (child) content elements
                              vc_map( array(
                                  "name" =&gt; __("Feature Block", "protechsaas"),
                                  "base" =&gt; "feature_container",
                                  "as_parent" =&gt; array('only' =&gt; 'feature'), // Use only|except attributes to limit child shortcodes (separate multiple values with comma)
                                  "content_element" =&gt; true,
                                  "show_settings_on_create" =&gt; false,
                                  "is_container" =&gt; true,
                                  "params" =&gt; array(
                                      // add params same as with any other content element
                                      array(
                                          "type" =&gt; "textfield",
                                          "heading" =&gt; __("Block Title", "protechsaas"),
                                          'holder' =&gt; 'h2',
                                          'class' =&gt; 'sub-title-class',
                                          "param_name" =&gt; "subtitle",
                                          "description" =&gt; __("add the title for your features block", "protechsaas")
                                      ),
                                      array(
                                          "type" =&gt; "textfield",
                                          "heading" =&gt; __("Title", "protechsaas"),
                                          'holder' =&gt; 'h2',
                                          'class' =&gt; 'title-class',
                                          "param_name" =&gt; "title",
                                          "description" =&gt; __("add the main title for your features block", "protechsaas")
                                      ),
                                      array(
                                          "type" =&gt; "textarea",
                                          "heading" =&gt; __("Content", "protechsaas"),
                                          'holder' =&gt; 'p',
                                          'class' =&gt; 'content-class',
                                          "param_name" =&gt; "content",
                                          "description" =&gt; __("add the main content for your features block", "protechsaas")
                                      ),
                                      array(
                                          'type' =&gt; 'dropdown',
                                          'holder' =&gt; 'div',
                                          'class' =&gt; 'style-class',
                                          'heading' =&gt; __( 'Block Style', 'protechsaas' ),
                                          'param_name' =&gt; 'blockstyle',
                                          'value' =&gt; array(
                                                      '1'   =&gt; 'Feature  white bg ',
                                                      '2'   =&gt; 'Feature  grey bg',
                                                      '3'   =&gt; 'Feature  icon bg none ',
                                                    ),
                                          'description' =&gt; __( 'choose you features block style', 'protechsaas' ),
                                          'admin_label' =&gt; true,
                                          'weight' =&gt; 0,
                                      ),
                                  ),
                                  "js_view" =&gt; 'VcColumnView'
                              ) );                             
  
                          }
                          // Element HTML
                          public function protechsaas_featured_block_html( $atts ,$features = null ) {
  
                              // Params extraction
                              extract(
                                  shortcode_atts(
                                      array(
                                          'subtitle' =&gt; '',
                                          'title' =&gt; '',
                                          'content' =&gt; '',
                                          'blockstyle' =&gt; '',
                                      ), 
                                      $atts
                                  )
                              );
  
                              switch ($blockstyle) {
                           case '1':
                              $html = '
                                      &lt;section class="client-speak our-features padding-lg"&gt;
                                          &lt;div class="container"&gt;
                                              &lt;div class="row justify-content-center head-block"&gt;
                                                  &lt;div class="col-md-10"&gt; &lt;span&gt;'.$subtitle.'&lt;/span&gt;
                                                      &lt;h2&gt;'.$title.'&lt;/h2&gt;
                                                      &lt;p class="hidden-xs"&gt;'.$content.'&lt;/p&gt;
                                                  &lt;/div&gt;
                                              &lt;/div&gt;
                                              &lt;ul class="row features-listing"&gt;
                                                  '.do_shortcode($features).'
                                              &lt;/ul&gt;
                                          &lt;/div&gt;
                                      &lt;/section&gt;'; 
                              break;
                           case '2':
                              $html = '
                                      &lt;section class="client-speak our-features padding-lg bg-white"&gt;
                                          &lt;div class="container"&gt;
                                              &lt;div class="row justify-content-center head-block"&gt;
                                                  &lt;div class="col-md-10"&gt; &lt;span&gt;'.$subtitle.'&lt;/span&gt;
                                                      &lt;h2&gt;'.$title.'&lt;/h2&gt;
                                                      &lt;p class="hidden-xs"&gt;'.$content.'&lt;/p&gt;
                                                  &lt;/div&gt;
                                              &lt;/div&gt;
                                              &lt;ul class="row features-listing ico-bg"&gt;
                                              '.do_shortcode($features).'
                                              &lt;/ul&gt;
                                          &lt;/div&gt;
                                      &lt;/section&gt;'; 
                              break;
                           case '3':
                              $html = '
                                     &lt;section class="client-speak our-features padding-lg"&gt;
                                          &lt;div class="container"&gt;
                                              &lt;div class="row justify-content-center head-block"&gt;
                                                  &lt;div class="col-md-10"&gt; &lt;span&gt;'.$subtitle.'&lt;/span&gt;
                                                      &lt;h2&gt;'.$title.'&lt;/h2&gt;
                                                      &lt;p class="hidden-xs"&gt;'.$content.'&lt;/p&gt;
                                                  &lt;/div&gt;
                                              &lt;/div&gt;
                                              &lt;ul class="row features-listing bg-none"&gt;
                                                  '.do_shortcode($features).'
                                              &lt;/ul&gt;
                                          &lt;/div&gt;
                                      &lt;/section&gt; '; 
                              break;
  
  
                           default:
                              $html = '
                                      &lt;section class="client-speak our-features padding-lg"&gt;
                                          &lt;div class="container"&gt;
                                              &lt;div class="row justify-content-center head-block"&gt;
                                                  &lt;div class="col-md-10"&gt; &lt;span&gt;'.$subtitle.'&lt;/span&gt;
                                                      &lt;h2&gt;'.$title.'&lt;/h2&gt;
                                                      &lt;p class="hidden-xs"&gt;'.$content.'&lt;/p&gt;
                                                  &lt;/div&gt;
                                              &lt;/div&gt;
                                              &lt;ul class="row features-listing"&gt;
                                                  '.do_shortcode($features).'
                                              &lt;/ul&gt;
                                          &lt;/div&gt;
                                      &lt;/section&gt;'; 
                               break;
                      }
                              return $html;
  
                          }
  
  
                      }
                  }
  
                  //feature element
                  if ( class_exists( 'WPBakeryShortCode' ) ) {
                      class protechsaasFeature extends WPBakeryShortCode {
                          // Element Init
                          function __construct() {
                              add_action( 'init', array( $this, 'protechsaas_feature_mapping' ) );
                              add_shortcode( 'protechsaas_feature', array( $this, 'protechsaas_feature_html' ) );
                          }
                          // Element Mapping
                          public function protechsaas_feature_mapping() {
  
                              // Stop all if VC is not enabled
                              if ( !defined( 'WPB_VC_VERSION' ) ) {
                                  return;
                              }
  
                              vc_map( array(
                                  "name" =&gt; __("Feature", "protechsaas"),
                                  "base" =&gt; "feature",
                                  "content_element" =&gt; true,
                                  "as_child" =&gt; array('only' =&gt; 'feature_container'), // Use only|except attributes to limit parent (separate multiple values with comma)
                                  "params" =&gt; array(
                                      // add params same as with any other content element
                                      array(
                                          "type" =&gt; "textfield",
                                          "heading" =&gt; __("title", "protechsaas"),
                                          "param_name" =&gt; "title",
                                          "description" =&gt; __("add the  title for your feature.", "protechsaas")
                                      ),
                                      array(
                                          "type" =&gt; "textarea",
                                          "heading" =&gt; __("Content", "protechsaas"),
                                          'holder' =&gt; 'p',
                                          'class' =&gt; 'content-class',
                                          "param_name" =&gt; "content",
                                          "description" =&gt; __("add the  content for your feature", "protechsaas")
                                      ),
                                      array(
                                          'type' =&gt; 'attach_image',
                                          'holder'=&gt; 'div',
                                          'class' =&gt; '',
                                          'heading' =&gt; __('Icon image', 'protechsaas'),
                                          'param_name' =&gt; 'iconimage',
                                          'description' =&gt; __('Choose an image for icon if ypu want use your own icons else keep it blank and choose icon from next field', 'protechsaas'),
                                      ),
                                      array(
                                          'type' =&gt; 'dropdown',
                                          'holder' =&gt; 'div',
                                          'class' =&gt; 'style-class',
                                          'heading' =&gt; __( 'Saas Icons', 'protechsaas' ),
                                          'param_name' =&gt; 'icon',
                                          'value' =&gt; array(
                                                      'icon-analytics'   =&gt; 'analytics ',
                                                      'icon-responsive'   =&gt; 'responsive',
                                                      'icon-support'   =&gt; 'support',
                                                      'icon-settings'   =&gt; 'settings',
                                                      'icon-file' =&gt; 'file',
                                                      'icon-graphic' =&gt; 'graphic',
                                                    ),
                                          'description' =&gt; __( 'choose you features block style', 'protechsaas' ),
                                          'admin_label' =&gt; true,
                                          'weight' =&gt; 0,
                                      ),
                                  )
                              ) );                           
  
                          }
                          // Element HTML
                          public function protechsaas_feature_html( $atts ) {
  
                              // Params extraction
                              extract(
                                  shortcode_atts(
                                      array(
                                          'iconimage'   =&gt; '',
                                          'title' =&gt; '',
                                          'content' =&gt; '',
                                          'icon' =&gt; '',
                                      ), 
                                      $atts
                                  )
                              );
  
                              if($iconimage != null){
                                  $bg=wp_get_attachment_image_src($iconimage,'full');
                                  $iconcontent = '&lt;img src="'.$bg[0].'" alt="icon" class="img-fluid"/&gt;';
                              }
                              else {
                                  $iconcontent ='&lt;span class="'.$icon.'"&gt;&lt;/span&gt;';
                              }
                              $html='
                                  &lt;li class="col-md-4"&gt;
                                      &lt;div class="inner"&gt; &lt;span class="icon"&gt;'.$iconcontent.'&lt;/span&gt;
                                          &lt;h3&gt;'.$title.'&lt;/h3&gt;
                                          &lt;p&gt;'.$content.'&lt;/p&gt;
                                      &lt;/div&gt;
                                  &lt;/li&gt;
                              ';
                              return $html;
  
                          }
  
                      }
                  }
  
              // Element Class Init
              new protechsaasFeaturedBlock();
  
              new protechsaasFeature();
  
              ?&gt;
  </code></pre>