'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
* @param string $html_filter_fields @since LP v4.4.6
* @param array $extra_data @since LP v4.4.6 { 'classes' => '' }
* @return string
* @since 4.2.8.7.1
* @version 1.0.1
*/
public static function html_popup_items_to_select_clone(
array $tabs,
string $html_items,
string $html_filter_fields = '',
array $extra_data = []
): string {
$html_tabs = '';
$i = 0;
foreach ( $tabs as $key => $label ) {
$tab_active = '';
if ( $i === 0 ) {
$tab_active = 'active';
++$i;
}
$html_tabs .= sprintf(
'
',
'wrap_items' => '
',
'search' => ! empty( $html_filter_fields ) ? $html_filter_fields : 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' => sprintf(
'',
];
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.1
*/
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' : '';
$struct = $args['struct'] ?? [];
$saved = $args['saved'] ?? '';
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( implode( ' ', $classes ) )
),
'heading' => $title ? sprintf(
'
%s
',
wp_kses_post( $title )
) : '',
'tabs' => $tabs ? sprintf(
'
%s
',
$html_tabs
) : '',
'wrap-content' => '
',
'content' => $content,
'wrap-content-end' => '
',
'wrap-end' => '
',
);
return Template::combine_components( $sections );
}
}