BP_XProfile_Field_Type_Datebox::get_field_settings( int $field_id )

Get settings for a given date field.


Parameters Parameters

$field_id

(int) (Required) ID of the field.


Top ↑

Return Return

(array)


Source Source

File: bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

	public static function get_field_settings( $field_id ) {
		$defaults = array(
			'date_format'          => 'Y-m-d',
			'date_format_custom'   => '',
			'range_type'           => 'absolute',
			'range_absolute_start' => date( 'Y' ) - 60,
			'range_absolute_end'   => date( 'Y' ) + 10,
			'range_relative_start' => '-10',
			'range_relative_end'   => '20',
		);

		$settings = array();
		foreach ( $defaults as $key => $value ) {
			$saved = bp_xprofile_get_meta( $field_id, 'field', $key, true );

			if ( $saved ) {
				$settings[ $key ] = $saved;
			} else {
				$settings[ $key ] = $value;
			}
		}

		$settings = self::validate_settings( $settings );

		return $settings;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.