Skip to content
Snippets Groups Projects
Commit ba79cfeb authored by Piotr Potrebka's avatar Piotr Potrebka
Browse files

feat: WP Editor

parent d3adfedd
No related branches found
No related tags found
1 merge request!30feat: WP Editor
Pipeline #150619 failed with stages
in 6 seconds
<?php
namespace WPDesk\Forms\Field;
class WPEditorField extends BasicField {
public function get_template_name(): string {
return 'wp-editor';
}
}
......@@ -2,6 +2,11 @@
namespace WPDesk\Forms\Field;
/**
* @deprecated
*
* Use WPEditorField
*/
class WyswigField extends BasicField {
public function get_template_name(): string {
......
<?php
/**
* @var \WPDesk\Forms\Field $field
* @var string $name_prefix
* @var string $value
*/
wp_print_styles( 'media-views' );
$default_settings = [
'textarea_name' => esc_attr( $name_prefix ) . '[' . esc_attr( $this->get_name() ) . ']',
'tinymce' => [
'toolbar1' => 'bold,italic,underline,separator,alignleft,aligncenter,alignright,separator,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
],
'media_buttons' => true,
'quicktags' => true,
'teeny' => true,
];
$editor_settings = wp_parse_args( $field->get_attributes(), $default_settings );
$editor_id = uniqid( 'wyswig_' );
wp_editor( wp_kses_post( $value ), $editor_id, $editor_settings );
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment