Avada Forums Community Forum Trying to add a custom builder component with children

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • mwaterous
    Participant
    Post count: 15

    Hoping someone here has experience creating custom fusion builder components. I’m trying to create a new multi element (nested shortcode) as per the documentation here:

    https://theme-fusion.com/documentation/fusion-builder/configure/add-new-multi-element-nested-shortcode-fusion-builder/

    Code is here:

    https://gist.github.com/mwaterous/41c7b16e1243c6417900141c88efe6cc

    Parent element works fine so far, but when I click “+ slide” to add a new slide (child element), nothing happens. No console errors. No errors on screen anywhere. Nothing.

    elliottbenzle
    Participant
    Post count: 2

    Had the same problem. Apparently the parent needs to have a tinymce field to contain the child element. See the tinymce param in the below code:

    Parent Element

    function fusion_element_download_access() {	
    	
    					fusion_builder_map( 
    						fusion_builder_frontend_data(
    							'FusionSC_DownloadAccess',
    							[
    								'name'       => esc_attr__( 'Download Access', 'fusion-builder' ),
    								'shortcode'  => 'fusion_content_download_access',
    								'multi'         => 'multi_element_parent',
    								'element_child' => 'fusion_download_access_link',
    								'child_ui'      => true,
    								'icon'       => 'fusiona-forms',
    								'admin_enqueue_js' => get_stylesheet_directory_uri() . '/js/fusion-download-access.js',
    								'preview'    => FUSION_BUILDER_PLUGIN_DIR . 'inc/templates/previews/fusion-menu-anchor-preview.php',
    								'preview_id' => 'fusion-builder-block-module-menu-anchor-preview-template',
    								'help_url'   => 'https://theme-fusion.com/documentation/fusion-builder/elements/menu-anchor-element/',
    								'params'     => [
    									[
    										'type'        => 'tinymce',
    										'heading'     => esc_attr__( 'Content', 'fusion-builder' ),
    										'description' => esc_attr__( 'Enter some content for this content box.', 'fusion-builder' ),
    										'param_name'  => 'element_content',
    										'value'       => '[fusion_download_access_link icon=""]' . esc_attr__( 'Your Content Goes Here', 'fusion-builder' ) . '[/fusion_download_access_link]',
    									],
    									[
    										'type'        => 'radio_button_set',
    										'heading'     => 'Button or Image',
    										'description' => 'Is the trigger a button or an image?',
    										'param_name'  => 'content_download_access_trigger_type',
    										'value'       => array(
    											'button' => esc_attr__( 'Button', 'fusion-builder' ),
    											'image'  => esc_attr__( 'Image', 'fusion-builder' ),
    									   ),
    									],
    									[
    										'type'        => 'textfield',
    										'heading'     => 'Button Text',
    										'description' => 'Text to appear on the button.',
    										'param_name'  => 'content_download_access_button_text'
    									],									
    								],
    							]
    						
    						)
    					);	
    }
    
    add_action( 'fusion_builder_before_init', 'fusion_element_download_access' );

    Child Element

    function fusion_element_download_access_item() {
    	fusion_builder_map(
    		fusion_builder_frontend_data(
    			'FusionSC_Checklist',
    			[
    				'name'              => esc_attr__( 'Download Link', 'fusion-builder' ),
    				'description'       => esc_attr__( 'Enter the URL and text for the download.', 'fusion-builder' ),
    				'shortcode'         => 'fusion_download_access_link',
    				'hide_from_builder' => true,
    				'allow_generator'   => true,
    				'inline_editor'     => true,
    				'tag_name'          => 'li',
    				'selectors'         => [
    					'class' => 'fusion-li-item',
    				],
    				'params'            => [
    					[
    						'type'        => 'textfield',
    						'heading'     => 'Link Text',
    						'description' => 'Text to display for download link',
    						'param_name'  => 'content_download_access_url_text'
    					],
    					[
    						'type'        => 'link_selector',
    						'heading'     => esc_attr__( 'Link URL', 'fusion-builder' ),
    						'description' => esc_attr__( 'The URL for the Download', 'fusion-builder' ),
    						'param_name'  => 'content_download_access_url',
    						'value'       => '',
    					],
    				],
    			],
    			'child'
    		)
    	);
    }
    add_action( 'fusion_builder_before_init', 'fusion_element_download_access_item' );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.