[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-xprofile/classes/ -> class-bp-xprofile-field-type.php (summary)

BuddyPress XProfile Classes.

File Size: 561 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 functions

  __construct()
  set_format()
  set_whitelist_values()
  set_allowed_values()
  is_valid()
  do_settings_section()
  edit_field_options_html()
  admin_new_field_html()
  pre_validate_filter()
  display_filter()
  admin_save_settings()
  get_edit_field_html_elements()

Functions
Functions that are not part of a class:

__construct()   X-Ref
Constructor.

since: 2.0.0

set_format( $format, $replace_format = 'add' )   X-Ref
Set a regex that profile data will be asserted against.

You can call this method multiple times to set multiple formats. When validation is performed,
it's successful as long as the new value matches any one of the registered formats.

return: BP_XProfile_Field_Type
param: string $format         Regex string.
param: string $replace_format Optional; if 'replace', replaces the format instead of adding to it.
since: 2.0.0

set_whitelist_values( $values )   X-Ref
Add a value to this type's list of allowed values that profile data will be asserted against.

return: BP_XProfile_Field_Type
param: string|array $values Whitelisted values.
since: 2.0.0

set_allowed_values( $values )   X-Ref
Add a value to this type's list of allowed values that profile data will be asserted against.

You can call this method multiple times to set multiple formats. When validation is performed,
it's successful as long as the new value matches any one of the registered formats.

return: BP_XProfile_Field_Type
param: string|array $values Allowed values.
since: 7.0.0

is_valid( $values )   X-Ref
Check the given string against the registered formats for this field type.

This method doesn't support chaining.

return: bool True if the value validates
param: string|array $values Value to check against the registered formats.
since: 2.0.0

do_settings_section()   X-Ref
Check whether the current field type should have a settings ("options") section on the Edit Field panel.

Falls back on `supports_options` if no value is set by the field type.

return: bool
since: 2.7.0

edit_field_options_html( array $args = array()   X-Ref
Output the edit field options HTML for this field type.

BuddyPress considers a field's "options" to be, for example, the items in a selectbox.
These are stored separately in the database, and their templating is handled separately.
Populate this method in a child class if it's required. Otherwise, you can leave it out.

This templating is separate from {@link BP_XProfile_Field_Type::edit_field_html()} because
it's also used in the wp-admin screens when creating new fields, and for backwards compatibility.

Must be used inside the {@link bp_profile_fields()} template loop.

param: array $args Optional. The arguments passed to {@link bp_the_profile_field_options()}.
since: 2.0.0

admin_new_field_html( BP_XProfile_Field $current_field, $control_type = '' )   X-Ref
Output HTML for this field type's children options on the wp-admin Profile Fields "Add Field" and "Edit Field" screens.

You don't need to implement this method for all field types. It's used in core by the
selectbox, multi selectbox, checkbox, and radio button fields, to allow the admin to
enter the child option values (e.g. the choices in a select box).

Must be used inside the {@link bp_profile_fields()} template loop.

param: BP_XProfile_Field $current_field The current profile field on the add/edit screen.
param: string            $control_type  Optional. HTML input type used to render the current
since: 2.0.0

pre_validate_filter( $field_value, $field_id = '' )   X-Ref
Allow field types to modify submitted values before they are validated.

In some cases, it may be appropriate for a field type to catch
submitted values and modify them before they are passed to the
is_valid() method. For example, URL validation requires the
'http://' scheme (so that the value saved in the database is always
a fully-formed URL), but in order to allow users to enter a URL
without this scheme, BP_XProfile_Field_Type_URL prepends 'http://'
when it's not present.

By default, this is a pass-through method that does nothing. Only
override in your own field type if you need this kind of pre-
validation filtering.

return: mixed
param: mixed      $field_value Submitted field value.
param: string|int $field_id    Optional. ID of the field.
since: 2.1.0
since: 2.4.0 Added the `$field_id` parameter.

display_filter( $field_value, $field_id = '' )   X-Ref
Allow field types to modify the appearance of their values.

By default, this is a pass-through method that does nothing. Only
override in your own field type if you need to provide custom
filtering for output values.

return: mixed
param: mixed      $field_value Field value.
param: string|int $field_id    ID of the field.
since: 2.1.0
since: 2.4.0 Added `$field_id` parameter.

admin_save_settings( $field_id, $settings )   X-Ref
Save miscellaneous settings related to this field type.

Override in a specific field type if it requires an admin save routine.

param: int   $field_id Field ID.
param: array $settings Array of settings.
since: 2.7.0

get_edit_field_html_elements( array $properties = array()   X-Ref
Get a sanitized and escaped string of the edit field's HTML elements and attributes.

Must be used inside the {@link bp_profile_fields()} template loop.
This method was intended to be static but couldn't be because php.net/lsb/ requires PHP >= 5.3.

return: string
param: array $properties Optional key/value array of attributes for this edit field.
since: 2.0.0



Generated: Mon Apr 29 01:01:07 2024 Cross-referenced by PHPXref 0.7.1