Tribe__Tickets_Plus__Meta::meta_is_required( int $ticket_id, string $slug )
Checks if the meta field is required by slug, for a specific ticket.
Contents
Parameters
- $ticket_id
-
(int) (Required) The ticket ID.
- $slug
-
(string) (Required) Meta field slug.
Return
(bool) Whether the ticket meta field has required meta.
Source
File: src/Tribe/Meta.php
public function meta_is_required( $ticket_id, $slug ) {
// Get the meta fields for this ticket
$ticket_meta = $this->get_meta_fields_by_ticket( $ticket_id );
foreach ( $ticket_meta as $meta ) {
// Bail if the slug is different from the one we want to check
if ( $slug !== $meta->slug ) {
continue;
}
// Get the value and get out of the loop
return ( 'on' === $meta->required );
}
return false;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |