Site icon Hip-Hop Website Design and Development

wp_editor in widget breaks after save (no buttons and visible tab damaged)

My objective is to get wp_editor working in a easy widget which the admin can use so as to add textual content content material on an admin choices web page.

Right here we go in wp-admin/widgets.php all the things appears sooo good proper.

After we attempt to save… Oh no….. Buttons are gone and the Visible tab now not works

After I have a look at the HTML it seems as if after updating TinyMCE simply decides it does not must load any buttons… Any concepts?

Edit: here is the supply for the plugin I wrote that is throwing this error

add_action('widgets_init', 'string_example_name_init');

operate string_example_name_init()
{
    register_widget('string_example_name');
}

class string_example_name extends WP_Widget
{
    public operate __construct()
    {
        $widget_details = array(
            'classname' => 'string_example_name',
            'description' => 'String Instance Title'
        );

        mother or father::__construct('string_example_name', 'String Instance Title', $widget_details);
    }

    public operate type($occasion)
    {
        $textcontent = '';
        if( !empty( $occasion['textcontent'] ) ) {
            $textcontent = $occasion['textcontent'];
        }

        ?>

        <div class="string-arena-gods" id="texxxt">
            <?php
            $rand    = rand( 0, 999 );
            $ed_id   = $this->get_field_id( 'wp_editor_' . $rand );
            $ed_name = $this->get_field_name( 'wp_editor_' . $rand );

            printf(
                '<enter kind="hidden" id="%s" title="%s" worth="%d" />',
                $this->get_field_id( 'the_random_number' ),
                $this->get_field_name( 'the_random_number' ),
                $rand
            );


            $content material   = 'Whats up World!';
            $editor_id = $ed_id;

            $settings = array(
                'media_buttons' => false,
                'textarea_rows' => 3,
                'textarea_name' => $ed_name,
                'teeny'         => true,
            );


            wp_editor( $content material, $editor_id, $settings );
            ?>
        </div>

        <div class='mfc-text'>

        </div>

        <?php

        echo $args['after_widget'];
    }

    public operate replace( $new_instance, $old_instance ) {
        $rand = (int) $new_instance['the_random_number'];
        $editor_content = $new_instance[ 'wp_editor_' . $rand ];
        $new_instance['wp_editor_' . $rand] = $editor_content;
        return $new_instance;
    }

    public operate widget( $args, $occasion ) {
        extract( $args );
        $textcontent = apply_filters( 'textcontent', $occasion['textcontent'] );
        ?>

        <div class="string widget flex">
            <?php


            ?>
        </div>
        <?php
    }
}