public function __construct() { parent::__construct(); $this->category = _x('Single Fields', 'xprofile field type category', 'bp-pseudo-role-field'); $this->name = _x('Pseudo Role', 'xprofile field type', 'bp-pseudo-role-field'); $this->set_format('', 'replace'); $this->supports_multiple_defaults = false; $this->accepts_null_value = true; $this->supports_options = false; do_action('bd_pseudo_role_field', $this); }
/** * If the current field is a Member type, add a new UI to set options description * * @param BP_XProfile_Field $current_field * @param string $control_type */ public function admin_new_field_html(BP_XProfile_Field $current_field, $control_type = '') { parent::admin_new_field_html($current_field, 'radio'); $type = array_search(get_class($this), bp_xprofile_get_field_types()); if ($current_field->type != $type) { return; } ?> <div id="member_types_description" class="postbox bp-options-box" style="margin-top: 15px;"> <h3><?php esc_html_e('Enter a description for each member type if needed', 'buddypress-group-restrictions'); ?> </h3> <div class="inside"> <?php // Get the existing options ? $options = $current_field->get_children(true); if (empty($options)) { ?> <p class="description"><?php esc_html_e('This part is not dynamic, you need to first save the options above before being able to describe them.', 'buddypress-group-restrictions'); ?> </p> <?php } else { foreach ($options as $option) { ?> <div class="bp-option"> <label style="display:block;font-weight:bold"> <?php printf(__('Description for %s', 'buddypress-group-restrictions'), esc_html($option->name)); ?> </label> <textarea style="width:95%" name="_cfbgr_option_description[<?php echo esc_attr($option->name); ?> ]"><?php echo esc_textarea($option->description); ?> </textarea> </div> <?php } } ?> </div> </div> <?php }