get_token_factory();
printf(
'';
}
/**
* @return array
*/
public function get_template_variables( Variable_Field_Data $variable_field_data ): array {
$post = $this->get_post( $variable_field_data->get_value() );
if ( null === $post ||
'attachment' !== $post->post_type ||
0 !== strpos( $post->post_mime_type, 'video/' ) ) {
return array(
'value' => '',
'mime_type' => '',
);
}
$attachment_url = (string) wp_get_attachment_url( $post->ID );
return array(
'value' => $attachment_url,
'mime_type' => $post->post_mime_type,
);
}
public function get_validation_template_variables( Variable_Field_Data $variable_field_data ): array {
return array(
'value' => 'https://site.com/video.mp4',
'mime_type' => 'video/mp4',
);
}
public function is_with_field_wrapper(
Layout_Settings $layout_settings,
Field_Settings $field_settings,
Field_Meta $field_meta
): bool {
return false;
}
}