JoeSz / Exopite-Simple-Options-Framework

Fast, easy and lightweight admin options/metabox form generator for WordPress Plugins and metaboxes.
GNU General Public License v3.0
78 stars 24 forks source link

Image field in repeater #17

Closed tahiriqbalnajam closed 5 years ago

tahiriqbalnajam commented 5 years ago

Hi, First thanks for such a super nice work. I am facing two problems

  1. Simple image field appear but getting error wp.media is not a function on select image button click

But it is working if I add editor on page

  1. After adding editor when image was working I put this in repeater, now this time I am getting error "ERROR: This field class is not available! (image)"
JoeSz commented 5 years ago

Hi,

Thank you :) Can you please paste here your config?

tahiriqbalnajam commented 5 years ago

$fields[] = array( 'title' => "Blackout Fabric", 'icon' => 'fa fa-paragraph', 'name' => 'blackoutcolorfabric', 'sections' => array(

            array(
                'title'  =>"Stark White",
                'name'   => 'starkwhite',
                'icon'   => 'fa fa-paragraph',
                'fields' => array(

                    array(
                        'type'    => 'group',
                        'id'      => 'tabbed_1_colorgroup',
                        'options' => array(
                            'repeater'          => true,
                            'accordion'         => true,
                            'button_title'      => esc_html__( 'Add Blackout Color', 'plugin-name' ),
                            'group_title'       => esc_html__( 'Accordion Title', 'plugin-name' ),
                            'limit'             => 50,
                            'sortable'          => true,
                        ),
                        'fields'  => array(

                            array(
                                'id'      => 'colorname',
                                'type'    => 'text',
                                'title'   => esc_html__( 'Color Name', 'plugin-name' ),
                                'attributes' => array(
                                    // mark this field az title, on type this will change group item title
                                    'data-title' => 'title',
                                    'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
                                ),
                            ),
                            array(
                                'type'    => 'group',
                                'id'      => 'tabbed_1_colorgroup_color',
                                'options' => array(
                                    'repeater'          => true,
                                    'accordion'         => true,
                                    'button_title'      => esc_html__( 'Add Fabric', 'plugin-name' ),
                                    'group_title'       => esc_html__( 'Blackout Fabric', 'plugin-name' ),
                                    'limit'             => 50,
                                    'sortable'          => true,
                                ),
                                'fields'  => array(

                                    array(
                                        'id'      => 'fabricname',
                                        'type'    => 'text',
                                        'title'   => esc_html__( 'Fabric Name', 'plugin-name' ),
                                    ),

                                    array(
                                        'id'      => 'fabricprice',
                                        'type'    => 'text',
                                        'title'   => esc_html__( 'Fabric Price', 'plugin-name' ),
                                    ),
                                    array(
                                        'id'    => 'image_1',
                                        'type'  => 'image',
                                        'title' => 'Image',
                                    ),

                                ),

                            ),

                        ),

                    ),

                ),
            ),

        ),

    );

    $fields[] = array(
        'title'  => esc_html__( 'Editor', 'exopite-combiner-minifier' ),
        'icon'   => 'fa fa-paragraph',
        'name'   => 'editors',
        'sections' => array(

            array(
                'title'  => esc_html__( 'WYSIWYG Editors', 'exopite-combiner-minifier' ),
                'name'   => 'editors2',
                'icon'   => 'fa fa-paragraph',
                'fields' => array(

                    array(
                        'id'     => 'editor_1',
                        'type'   => 'editor',
                        'title'  => 'Editor TinyMCE',
                    ),

                    array(
                        'id'     => 'editor_trumbowyg',
                        'type'   => 'editor',
                        'title'  => 'Editor Trumbowyg',
                        'editor' => 'trumbowyg',
                    ),

                ),
            ),

        ),

    );

    $options_panel = new Exopite_Simple_Options_Framework( $config_submenu, $fields );
tahiriqbalnajam commented 5 years ago

By the way I am using https://github.com/JoeSz/WordPress-Plugin-Boilerplate-Tutorial have replace latest files from your repository.

JoeSz commented 5 years ago

Please try now (I updated both Options Framework and "WordPress-Plugin-Boilerplate-Tutorial")

tahiriqbalnajam commented 5 years ago

Thank you soooo much, working fine now.

JoeSz commented 5 years ago

Your welcome! it is not perfect (the patch), but it works. I will release the next version as soon as I'm done.

JoeSz commented 5 years ago

The new version is out.

tahiriqbalnajam commented 5 years ago

Great, Can I share more issues :)

JoeSz commented 5 years ago

If you find any, please. I can not test for all possible variation. I also can not promise, that I fix all of them so fast :D But please create a new issue.