| 1 |
<?php |
| 2 |
|
| 3 |
class acf_field_tab extends acf_field |
| 4 |
{ |
| 5 |
|
| 6 |
/* |
| 7 |
* __construct |
| 8 |
* |
| 9 |
* Set name / label needed for actions / filters |
| 10 |
* |
| 11 |
* @since 3.6 |
| 12 |
* @date 23/01/13 |
| 13 |
*/ |
| 14 |
|
| 15 |
function __construct() |
| 16 |
{ |
| 17 |
// vars |
| 18 |
$this->name = 'tab'; |
| 19 |
$this->label = __("Tab",'acf'); |
| 20 |
$this->category = __("Layout",'acf'); |
| 21 |
|
| 22 |
// do not delete! |
| 23 |
parent::__construct(); |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
/* |
| 28 |
* create_field() |
| 29 |
* |
| 30 |
* Create the HTML interface for your field |
| 31 |
* |
| 32 |
* @param $field - an array holding all the field's data |
| 33 |
* |
| 34 |
* @type action |
| 35 |
* @since 3.6 |
| 36 |
* @date 23/01/13 |
| 37 |
*/ |
| 38 |
|
| 39 |
function create_field( $field ) |
| 40 |
{ |
| 41 |
echo '<div class="acf-tab" data-id="' . $field['key'] . '">' . $field['label'] . '</div>'; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
/* |
| 47 |
* create_options() |
| 48 |
* |
| 49 |
* Create extra options for your field. This is rendered when editing a field. |
| 50 |
* The value of $field['name'] can be used (like bellow) to save extra data to the $field |
| 51 |
* |
| 52 |
* @param $field - an array holding all the field's data |
| 53 |
* |
| 54 |
* @type action |
| 55 |
* @since 3.6 |
| 56 |
* @date 23/01/13 |
| 57 |
*/ |
| 58 |
|
| 59 |
function create_options( $field ) |
| 60 |
{ |
| 61 |
?> |
| 62 |
<tr class="field_option field_option_<?php echo $this->name; ?>"> |
| 63 |
<td class="label"> |
| 64 |
<label><?php _e("Instructions",'acf'); ?></label> |
| 65 |
</td> |
| 66 |
<td> |
| 67 |
<p><?php _e("All fields proceeding this \"tab field\" (or until another \"tab field\" is defined) will appear grouped on the edit screen.",'acf'); ?></p> |
| 68 |
<p><?php _e("You can use multiple tabs to break up your fields into sections.",'acf'); ?></p> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
<?php |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
new acf_field_tab(); |
| 78 |
|
| 79 |
?> |