| @@ 6-30 (lines=25) @@ | ||
| 3 | /** |
|
| 4 | * Add custom options for date fields |
|
| 5 | */ |
|
| 6 | class GravityView_Field_Date_Created extends GravityView_Field { |
|
| 7 | ||
| 8 | var $name = 'date_created'; |
|
| 9 | ||
| 10 | var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' ); |
|
| 11 | ||
| 12 | var $group = 'meta'; |
|
| 13 | ||
| 14 | public function __construct() { |
|
| 15 | $this->label = esc_attr__( 'Date Created', 'gravityview' ); |
|
| 16 | parent::__construct(); |
|
| 17 | } |
|
| 18 | ||
| 19 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
| 20 | ||
| 21 | if( 'edit' === $context ) { |
|
| 22 | return $field_options; |
|
| 23 | } |
|
| 24 | ||
| 25 | $this->add_field_support('date_display', $field_options ); |
|
| 26 | ||
| 27 | return $field_options; |
|
| 28 | } |
|
| 29 | ||
| 30 | } |
|
| 31 | ||
| 32 | new GravityView_Field_Date_Created; |
|
| 33 | ||
| @@ 8-31 (lines=24) @@ | ||
| 5 | * |
|
| 6 | * @since 1.7 |
|
| 7 | */ |
|
| 8 | class GravityView_Field_Post_ID extends GravityView_Field { |
|
| 9 | ||
| 10 | var $name = 'post_id'; |
|
| 11 | ||
| 12 | var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' ); |
|
| 13 | ||
| 14 | var $group = 'post'; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * GravityView_Field_Post_ID constructor. |
|
| 18 | */ |
|
| 19 | public function __construct() { |
|
| 20 | $this->label = __( 'Post ID', 'gravityview' ); |
|
| 21 | parent::__construct(); |
|
| 22 | } |
|
| 23 | ||
| 24 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
| 25 | ||
| 26 | $this->add_field_support('link_to_post', $field_options ); |
|
| 27 | ||
| 28 | return $field_options; |
|
| 29 | } |
|
| 30 | ||
| 31 | } |
|
| 32 | ||
| 33 | new GravityView_Field_Post_ID; |
|
| 34 | ||