PluginProbe
Advanced Custom Fields (ACF®) / 3.1.5
Advanced Custom Fields (ACF®) v3.1.5
6.8.9 6.8.8 6.8.7 6.8.6 6.8.5 6.8.4 6.8.3 6.8.2 6.8.1 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.2 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 All 230 releases
advanced-custom-fields / core / fields / date_picker / date_picker.php
date_picker.php
97 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class acf_Date_picker extends acf_Field
4 {
5
6 /*--------------------------------------------------------------------------------------
7 *
8 * Constructor
9 *
10 * @author Elliot Condon
11 * @since 1.0.0
12 * @updated 2.2.0
13 *
14 *-------------------------------------------------------------------------------------*/
15
16 function __construct($parent)
17 {
18 parent::__construct($parent);
19
20 $this->name = 'date_picker';
21 $this->title = __("Date Picker",'acf');
22
23 }
24
25
26 /*--------------------------------------------------------------------------------------
27 *
28 * admin_head
29 *
30 * @author Elliot Condon
31 * @since 2.0.6
32 *
33 *-------------------------------------------------------------------------------------*/
34
35 function admin_head()
36 {
37 // add datepicker
38 echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/core/fields/date_picker/style.date_picker.css" />';
39 echo '<script type="text/javascript" src="'.$this->parent->dir.'/core/fields/date_picker/jquery.ui.datepicker.js" ></script>';
40 }
41
42
43 /*--------------------------------------------------------------------------------------
44 *
45 * create_field
46 *
47 * @author Elliot Condon
48 * @since 2.0.5
49 * @updated 2.2.0
50 *
51 *-------------------------------------------------------------------------------------*/
52
53 function create_field($field)
54 {
55 // vars
56 $field['date_format'] = isset($field['date_format']) ? $field['date_format'] : 'dd/mm/yy';
57
58 // html
59 echo '<input type="text" value="' . $field['value'] . '" class="acf_datepicker" name="' . $field['name'] . '" data-date_format="' . $field['date_format'] . '" />';
60
61 }
62
63
64 /*--------------------------------------------------------------------------------------
65 *
66 * create_options
67 *
68 * @author Elliot Condon
69 * @since 2.0.6
70 * @updated 2.2.0
71 *
72 *-------------------------------------------------------------------------------------*/
73
74 function create_options($key, $field)
75 {
76 // defaults
77 $field['date_format'] = isset($field['date_format']) ? $field['date_format'] : '';
78
79 ?>
80 <tr class="field_option field_option_<?php echo $this->name; ?>">
81 <td class="label">
82 <label><?php _e("Date format",'acf'); ?></label>
83 <p class="description"><?php _e("eg. dd/mm/yy. read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate">formatDate</a></p>
84 </td>
85 <td>
86 <input type="text" name="fields[<?php echo $key; ?>][date_format]" value="<?php echo $field['date_format']; ?>" />
87 </td>
88 </tr>
89
90 <?php
91 }
92
93
94
95 }
96
97 ?>