WP_Widget_Text::表单(阵列 $实例 )

输出文本小部件设置窗体。

描述

另请参见

参数

$实例阵列必修的
当前设置。

来源

公共函数窗体($instance){$实例=wp_parse_args((数组)$实例,阵列(“标题”=>“”,“文本”=>“”,));?><?php if(!$this->is_legacyinstance($instance)):?><?php(电话)if(user_can_richedit()){add_filter('the_editor_content','format_for_editor',10,2);$default_editor='tinymce';}其他{$default_editor=“html”;}/**该过滤器记录在wp-includes/class-wp-editor.php中*/$text=应用过滤器('the_editor_content',$instance['text'],$default_editor);//重置过滤器添加。if(user_can_richedit()){remove_filter('编辑内容','格式_for_editor');}//防止在format_for_editor()不适用或_editor_content过滤器做了错误的事情时过早关闭文本区域。$escaped_text=preg_replace(“#</textarea#i”,“&lt;/textarea”,$text);?><input id=“<?php echo$this->get_field_id('title');?>”name=“<?php echo$this->get_field_name('titel');”>“class=”title sync-input“type=”hidden“value=”<?php-echo esc_attr($instance['title']);?>>“>”><textarea id=“<?php echo$this->get_field_id('text');?>”name=“<?php echo$this->get_field_name('text`);?>>”class=“text sync-input”隐藏>>?php echo$escaped_text;?></文本区域><input id=“<?php echo$this->get_field_id('filter');?>”name=“<input id=“<?php echo$this->get_field_id('visual');?>”name=“<?php其他:?><input id=“<?php echo$this->get_field_id('visual');?>”name=“<p><label for=“<?php echo$this->get_field_id('title');?>”><?php _e('标题:');?></标签><input class=“widefat”id=“<?php echo$this->get_field_id('title');?>”name=“<?hp echo$this->get_field_name('titel');”>“type=”text“value=”<?php-echo esc_attr($instance['title']);?>>“/></p><?php(电话)if(!isset($instance['visual'])){$widget_info_message=__('此小部件可能包含在&#8220;自定义HTML&#8221;小部件中工作得更好的代码。改为尝试该小部件如何?');}其他{$widget_info_message=__('此小部件可能包含在&#8220;自定义HTML&#8221;小部件中工作得更好的代码。如果您还没有,那么尝试一下该小部件怎么样?');}wp_admin_notice(管理员通知)($widget_info_消息,阵列(“type”=>“info”,“additional_classes”=>数组(“notice-alt”,“inline”),));?><p><label for=“<?php echo$this->get_field_id('text');?>”><?php_e('内容:');?></标签><textarea class=“widefat”rows=“16”cols=“20”id=“<?php echo$this->get_field_id('text');?>”name=“<?hp echo$this->get_field_name('text`);?>>”>?php echo esc_textarea($instance['text']);?></文本区域></p><p><input id=“<?php echo$this->get_field_id('filter');?>”name=“<?php echo$this->get_field_name('filter');?>”type=“checkbox”<?php已检查(!empty($instance['filter']));?>/>&nbsp<label for=“<?php echo$this->get_field_id('filter');?>”><?php_e('自动添加段落');?></标签></p><?php(电话)endif;}

挂钩

应用筛选器('编辑内容',一串 $内容,一串 $default_editor(默认编辑器) )

过滤默认编辑器内容。

变更日志

版本描述
4.8.1恢复了在传统模式下显示的原始表单。
4.8.0表单只包含与JS模板同步的隐藏输入。
2.8.0介绍。

用户贡献的笔记

你必须登录在能够发表注释或反馈之前。