'tinymce', 'media_buttons' => true, 'editor_class' => 'lp-editor-tinymce', 'editor_height' => 210, ], $setting ); ob_start(); wp_editor( $value, $id_name, $args ); return ob_get_clean(); } /** * HTML for popup items to select. * * @param array $tabs [ [ key => label ] ]. * @param string $html_items * * @return string */ public static function html_popup_items_to_select_clone( array $tabs, string $html_items ): string { $html_tabs = ''; $i = 0; foreach ( $tabs as $key => $label ) { $tab_active = ''; if ( $i === 0 ) { $tab_active = 'active'; ++$i; } $html_tabs .= sprintf( '
  • %s
  • ', $key, $tab_active, $label ); } $section_header = [ 'wrap' => '
    ', 'count' => '
    ', 'tabs' => sprintf( '', $html_tabs ), 'wrap_end' => '
    ', ]; $section_main = [ 'wrap' => '
    ', 'wrap_items' => '
    ', 'search' => sprintf( '', 'lp-search-title-item', __( 'Type here to search for an item', 'learnpress' ) ), 'list-items' => $html_items, 'wrap_items_end' => '
    ', 'list-items-selected' => ' ', 'wrap_end' => '
    ', ]; $section_footer = [ 'wrap' => '', ]; $section = [ 'wrap' => '
    ', 'header' => Template::combine_components( $section_header ), 'main' => Template::combine_components( $section_main ), 'footer' => Template::combine_components( $section_footer ), 'wrap_end' => '
    ', ]; return Template::combine_components( $section ); } /** * HTML for tom select. * * @param array $args { * Arguments. * * @type array $options Options for select. * @type string $name Name attribute for select. * @type string $class_name Class name for select. * } * * @return string * @since 4.3.0 * @version 1.0.0 */ public static function html_tom_select( array $args = [] ): string { $html_options = ''; $options = $args['options'] ?? []; $name = $args['name'] ?? ''; $class_name = $args['class_name'] ?? ''; $default_value = $args['default_value'] ?? ''; $multiple = $args['multiple'] ?? false; $multiple = $multiple ? 'multiple' : ''; foreach ( $options as $key => $value ) { if ( is_array( $default_value ) ) { $selected = in_array( $key, $default_value, true ) ? 'selected' : ''; } else { $selected = selected( $default_value, $key, false ); } $html_options .= sprintf( '', esc_attr( $key ), $selected, esc_html( $value ) ); } $section = [ 'select' => sprintf( '', ]; return Template::combine_components( $section ); } }