Tribe__JSON_LD__Abstract::get_markup( $post = null, $args = array() )
puts together the actual html/json javascript block for output
Return
(string)
Source
File: src/Tribe/JSON_LD/Abstract.php
public function get_markup( $post = null, $args = array() ) {
$data = $this->get_data( $post, $args );
$type = strtolower( esc_attr( $this->type ) );
$this->set_type( $post, $type );
foreach ( $data as $post_id => $_data ) {
// Register this post as done already
$this->register( $post_id );
}
/**
* Allows the event data to be modifed by themes and other plugins.
*
* @example tribe_json_ld_thing_data
* @example tribe_json_ld_event_data
*
* @param array $data objects representing the Google Markup for each event.
* @param array $args the arguments used to get data
*/
$data = apply_filters( "tribe_json_ld_{$type}_data", $data, $args );
// Strip the post ID indexing before returning
$data = array_values( $data );
if ( ! empty( $data ) ) {
$html[] = '<script type="application/ld+json">';
$html[] = str_replace( '\/', '/', json_encode( $data ) );
$html[] = '</script>';
}
return ! empty( $html ) ? implode( "\r\n", $html ) : '';
}