Provider::render_default_ticket_type_header( string $file, TECTicketsAdminarray $name, Tribe__Tickets__Admin__Views $admin_views )
Render the default ticket type header.
Contents
Parameters
- $file
-
(string) (Required) The file being rendered.
- $name
-
(<span class="TECTicketsAdminarray">TECTicketsAdminarray) (Required) The components of the name of the template being filtered..
- $admin_views
-
(Tribe__Tickets__Admin__Views) (Required) The admin views instance.
Source
File: src/Tickets/Admin/Provider.php
public function render_default_ticket_type_header( string $file, array $name, Admin_Views $admin_views ): void {
$context = $admin_views->get_values();
$post_id = $context['post_id'] ?? '';
$ticket_type = $context['ticket_type'] ?? '';
if ( 'default' !== $ticket_type || empty( $post_id ) ) {
return;
}
$post_type_object = get_post_type_object( get_post_type( $post_id ) );
$post_type = strtolower( get_post_type_labels( $post_type_object )->{'singular_name'} );
$description = sprintf(
// Translators: %1$s is the ticket type label_lowercase, %2$s is the post type label.
_x(
'A single %1$s is specific to this %2$s.',
'The help text for the default ticket type in the ticket form.',
'event-tickets'
),
tribe_get_ticket_label_singular_lowercase( 'admin_ticket_type_help_text' ),
$post_type
);
/**
* Allows for the modification of the default ticket type header description.
*
* Note the description will be passed through `wp_kses` with support for anchor tags.
*
* @since 5.8.0
*
* @param string $description The default description.
* @param int $post_id The ID of the post the ticket is being added to, or rendered for.
*/
$description = apply_filters( 'tec_tickets_ticket_type_default_header_description', $description, $post_id );
$admin_views->template( 'editor/ticket-type-default-header', [
'description' => $description,
] );
}
Changelog
| Version | Description |
|---|---|
| 5.8.0 | Introduced. |