Function Reference: geodir_cfi_datepicker
Summary
Get the html input for the custom field: datepicker
Parameters
- $html
- (string) (required) The html to be filtered.
- Default: None
- $cf
- (array) (required) The custom field array details.
- Default: None
Return Values
- (string)
- The html to output for the custom field.
Change Log
Since: 1.6.6
Filters
‘geodir_custom_field_input_datepicker_{$html_var}’ [Line: 803]
‘gd_datepicker_extra_{$name}’ [Line: 853]
Source File
geodir_cfi_datepicker() is located in geodirectory-functions/custom_fields_input_functions.php [Line: 790]
Source Code
function geodir_cfi_datepicker($html,$cf){ $html_var = $cf['htmlvar_name']; // Check if there is a custom field specific filter. if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ /** * Filter the datepicker html by individual custom field. * * @param string $html The html to filter. * @param array $cf The custom field array. * @since 1.6.6 */ $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); } // If no html then we run the standard output. if(empty($html)) { ob_start(); // Start buffering; $value = geodir_get_cf_value($cf); $extra_fields = unserialize($cf['extra_fields']); $name = $cf['name']; if ($extra_fields['date_format'] == '') $extra_fields['date_format'] = 'yy-mm-dd'; $date_format = $extra_fields['date_format']; $jquery_date_format = $date_format; // check if we need to change the format or not $date_format_len = strlen(str_replace(' ', '', $date_format)); if($date_format_len>5){// if greater then 5 then it's the old style format. $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format $replace = array('d','j','l','m','n','F','Y');//PHP date format $date_format = str_replace($search, $replace, $date_format); }else{ $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); } if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty if($value && !isset($_REQUEST['backandedit'])) { //$time = strtotime($value); //$value = date_i18n($date_format, $time); } $value = geodir_date($value, 'Y-m-d', $date_format); ?>