Tribe__Tickets_Plus__Meta::generate_field( int $ticket_id, string $type, array $data = array() )
Generates a field object
Contents
Parameters
- $ticket_id
-
(int) (Required) ID of ticket post the field is attached to.
- $type
-
(string) (Required) Type of field being generated.
- $data
-
(array) (Optional) Field settings for the field.
Default value: array()
Return
(Tribe__Tickets_Plus__Meta__Field__Abstract_Field) child class
Source
File: src/Tribe/Meta.php
public function generate_field( $ticket_id, $type, $data = array() ) {
$class = 'Tribe__Tickets_Plus__Meta__Field__' . ucwords( $type );
if ( ! class_exists( $class ) ) {
return null;
}
return new $class( $ticket_id, $data );
}
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Added support for filtering the field class. |
| 4.1 | Introduced. |