/**
  * {@inheritdoc}
  */
 public function register_fields($wp_fields)
 {
     $this->register_control_types($wp_fields);
     ////////////////////////////
     // Core: Personal Options //
     ////////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-personal-options', null, array('title' => __('Personal Options'), 'form' => $this->id));
     $field_args = array('sanitize_callback' => array($this, 'sanitize_rich_editing'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Visual Editor'), 'description' => __('Disable the visual editor when writing'), 'capabilities_callback' => array($this, 'capability_is_subscriber_editing_profile'), 'checkbox_value' => 'false', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'rich_editing', null, $field_args);
     $field_args = array('control' => array('type' => 'user-color-scheme', 'section' => $this->id . '-personal-options', 'label' => __('Admin Color Scheme'), 'description' => __('Disable the visual editor when writing'), 'capabilities_callback' => array($this, 'capability_has_color_scheme_control'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'admin_color', null, $field_args);
     $field_args = array('sanitize_callback' => array($this, 'sanitize_comment_shortcuts'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Keyboard Shortcuts'), 'description' => __('Enable keyboard shortcuts for comment moderation.') . ' ' . __('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'), 'capabilities_callback' => array($this, 'capability_is_subscriber_editing_profile'), 'checkbox_value' => 'true', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'comment_shortcuts', null, $field_args);
     $field_args = array('sanitize_callback' => array($this, 'sanitize_admin_bar_front'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Toolbar'), 'description' => __('Show Toolbar when viewing site'), 'checkbox_value' => 'true', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'admin_bar_front', null, $field_args);
     ////////////////
     // Core: Name //
     ////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-name', null, array('title' => __('Name'), 'form' => $this->id));
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('Username'), 'description' => __('Usernames cannot be changed.'), 'input_attrs' => array('disabled' => 'disabled'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_login', null, $field_args);
     $field_args = array('control' => array('type' => 'user-role', 'section' => $this->id . '-name', 'label' => __('Role'), 'capabilities_callback' => array($this, 'capability_show_roles'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'role', null, $field_args);
     $field_args = array('value_callback' => array($this, 'value_is_super_admin'), 'control' => array('type' => 'user-super-admin', 'section' => $this->id . '-name', 'label' => __('Super Admin'), 'description' => __('Grant this user super admin privileges for the Network.'), 'capabilities_callback' => array($this, 'capability_can_grant_super_admin'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'super_admin', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('First Name'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'first_name', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('Last Name'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'last_name', null, $field_args);
     $field_args = array('control' => array('id' => 'nickname', 'type' => 'text', 'section' => $this->id . '-name', 'label' => __('Nickname'), 'description' => __('(required)'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_nickname', null, $field_args);
     $field_args = array('control' => array('type' => 'user-display-name', 'section' => $this->id . '-name', 'label' => __('Display name publicly as'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'display_name', null, $field_args);
     ////////////////////////
     // Core: Contact Info //
     ////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-contact-info', null, array('title' => __('Contact Info'), 'form' => $this->id));
     $field_args = array('control' => array('id' => 'email', 'type' => 'user-email', 'section' => $this->id . '-contact-info', 'label' => __('E-mail'), 'description' => __('(required)'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_email', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-contact-info', 'label' => __('Website'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_url', null, $field_args);
     $contact_methods = wp_get_user_contact_methods();
     foreach ($contact_methods as $method => $label) {
         /**
          * Filter a user contactmethod label.
          *
          * The dynamic portion of the filter hook, `$name`, refers to
          * each of the keys in the contactmethods array.
          *
          * @since 2.9.0
          *
          * @param string $label The translatable label for the contactmethod.
          */
         $label = apply_filters("user_{$method}_label", $label);
         $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-contact-info', 'label' => $label, 'internal' => true));
         $wp_fields->add_field($this->object_type, $method, null, $field_args);
     }
     /////////////////
     // Core: About //
     /////////////////
     $about_title = __('About the user');
     if (defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE) {
         $about_title = __('About Yourself');
     }
     $wp_fields->add_section($this->object_type, $this->id . '-about', null, array('title' => $about_title, 'form' => $this->id));
     $field_args = array('control' => array('type' => 'textarea', 'section' => $this->id . '-about', 'label' => __('Biographical Info'), 'description' => __('Share a little biographical information to fill out your profile. This may be shown publicly.'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'description', null, $field_args);
     //////////////////////////////
     // Core: Account Management //
     //////////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-account-management', null, array('title' => __('Account Management'), 'form' => $this->id, 'capabilities_callback' => array($this, 'capability_show_password_fields')));
     $field_args = array('control' => array('type' => 'user-password', 'section' => $this->id . '-account-management', 'label' => __('Password'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_pass', null, $field_args);
     $field_args = array('control' => array('type' => 'user-sessions', 'section' => $this->id . '-account-management', 'label' => __('Sessions'), 'internal' => true));
     // If password fields not shown, show Sessions under About
     // @todo Change which section this control is in if password fields not shown
     /*if ( ! $show_password_fields ) {
     			$field_args['control']['section'] = $this->id . '-about';
     		}*/
     $wp_fields->add_field($this->object_type, 'sessions', null, $field_args);
     // @todo Figure out how best to run actions after section
     //if ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
     /**
      * Fires after the 'About Yourself' settings table on the 'Your Profile' editing form.
      *
      * The action only fires if the current user is editing their own profile.
      *
      * @since 2.0.0
      *
      * @param WP_User $profileuser The current WP_User object.
      */
     //do_action( 'show_user_profile', $profileuser );
     //} else {
     /**
      * Fires after the 'About the User' settings table on the 'Edit User' form.
      *
      * @since 2.0.0
      *
      * @param WP_User $profileuser The current WP_User object.
      */
     //do_action( 'edit_user_profile', $profileuser );
     //}
     ///////////////////////////////////
     // Core: Additional Capabilities //
     ///////////////////////////////////
     $wp_fields->add_section($this->object_type, 'additional-capabilities', null, array('title' => __('Additional Capabilities'), 'form' => $this->id, 'capabilities_callback' => array($this, 'capability_show_capabilities')));
     $field_args = array('control' => array('type' => 'user-capabilities', 'section' => 'additional-capabilities', 'label' => __('Capabilities'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'capabilities', null, $field_args);
     // Add example fields
     parent::register_fields($wp_fields);
 }
 /**
  * {@inheritdoc}
  */
 public function register_fields($wp_fields)
 {
     // Make sure primary term fields are registered
     $this->register_term_fields($wp_fields);
     ////////////////
     // Core: Term //
     ////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-main', null, array('title' => __('Term'), 'form' => $this->id, 'display_title' => false));
     $control_args = array('input_name' => 'name', 'type' => 'text', 'section' => $this->id . '-main', 'label' => __('Name'), 'description' => __('The name is how it appears on your site.'), 'fields' => 'name', 'internal' => true, 'wrap_attr' => array('class' => 'form-required'));
     if ('term-add' == $this->id) {
         $control_args['input_name'] = 'tag-name';
     }
     $wp_fields->add_control($this->object_type, $this->id . '-name', null, $control_args);
     $control_args = array('input_name' => 'slug', 'type' => 'text', 'section' => $this->id . '-main', 'label' => __('Slug'), 'description' => __('The "slug" is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'), 'capabilities_callback' => array($this, 'capability_is_global_terms_disabled'), 'fields' => 'slug', 'internal' => true);
     $wp_fields->add_control($this->object_type, $this->id . '-slug', null, $control_args);
     $control_args = array('input_name' => 'parent', 'type' => 'dropdown-terms', 'section' => $this->id . '-main', 'label' => __('Parent'), 'description' => __('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'), 'capabilities_callback' => array($this, 'capability_is_taxonomy_hierarchical'), 'exclude_tree_current_item_id' => true, 'placeholder_text' => __('None'), 'fields' => 'parent', 'internal' => true);
     $wp_fields->add_control($this->object_type, $this->id . '-parent', null, $control_args);
     $control_args = array('input_name' => 'description', 'type' => 'textarea', 'section' => $this->id . '-main', 'label' => __('Description'), 'description' => __('The description is not prominent by default; however, some themes may show it.'), 'input_attrs' => array('rows' => '5', 'cols' => '40'), 'fields' => 'description', 'internal' => true);
     $wp_fields->add_control($this->object_type, $this->id . '-description', null, $control_args);
     // Add example fields
     parent::register_fields($wp_fields);
     return;
     // @todo Maintain some sort of filter on the $args, see taxonomy_parent_dropdown_args, has to be done during render of control
     $dropdown_args = array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'));
     /**
      * Filter the taxonomy parent drop-down on the Edit Term page.
      *
      * @since 3.7.0
      * @since 4.2.0 Added `$context` parameter.
      *
      * @param array   $dropdown_args    {
      *                                  An array of taxonomy parent drop-down arguments.
      *
      * @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0|false.
      * @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
      * @type string   $taxonomy         The taxonomy slug.
      * @type string   $name             Value of the name attribute to use for the drop-down select element.
      *                                      Default 'parent'.
      * @type string   $orderby          The field to order by. Default 'name'.
      * @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
      * @type string   $show_option_none Label to display if there are no terms. Default 'None'.
      * }
      *
      * @param string  $taxonomy         The taxonomy slug.
      * @param string  $context          Filter context. Accepts 'new' or 'edit'.
      */
     $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new');
     // @todo Need compatibility hooks added for within <table> markup
     // Back compat hooks
     if ('category' == $taxonomy) {
         /**
          * Fires after the Edit Category form fields are displayed.
          *
          * @since      2.9.0
          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
          *
          * @param object $tag Current category term object.
          */
         do_action('edit_category_form_fields', $tag);
     } elseif ('link_category' == $taxonomy) {
         /**
          * Fires after the Edit Link Category form fields are displayed.
          *
          * @since      2.9.0
          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
          *
          * @param object $tag Current link category term object.
          */
         do_action('edit_link_category_form_fields', $tag);
     } else {
         /**
          * Fires after the Edit Tag form fields are displayed.
          *
          * @since      2.9.0
          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
          *
          * @param object $tag Current tag term object.
          */
         do_action('edit_tag_form_fields', $tag);
     }
     /**
      * Fires after the Edit Term form fields are displayed.
      *
      * The dynamic portion of the hook name, `$taxonomy`, refers to
      * the taxonomy slug.
      *
      * @since 3.0.0
      *
      * @param object $tag      Current taxonomy term object.
      * @param string $taxonomy Current taxonomy slug.
      */
     do_action("{$taxonomy}_edit_form_fields", $tag, $taxonomy);
 }