cmb2_get_oembed

Get a cmb oEmbed.

Description

(string) cmb2_get_oembed( (array) $args = array() ); 

Handles oEmbed getting for non-post objects

Returns (string)

oEmbed string

Parameters (1)

0. $args — Optional. (array) => array()
Arguments. Accepts: url - URL to retrieve the oEmbed from, object_id, - $post_id, object_type - post, oembed_args - $embed_args, // array containing width, etc field_id - false, cache_key - false,

Usage

  1. if ( !function_exists( 'cmb2_get_oembed' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/includes/libraries/metabox/includes/helper-functions.php'; 
  3. $args = array(); 
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cmb2_get_oembed($args); 
  7.  

Defined (2)

The function is defined in the following location(s).

/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_oembed( $args = array() ) { 
  2. returncmb2_ajax)->get_oembed( $args ); 
/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_oembed( $args = array() ) { 
  2. $oembed =cmb2_ajax)->get_oembed_no_edit( $args ); 
  3.  
  4. // Send back our embed 
  5. if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) { 
  6. return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>'; 
  7.  
  8. $error = sprintf( __( 'No oEmbed Results Found for %s. View more info at %s', cmb2 ), $oembed['fallback'], ' <a href="http://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>.' ); 
  9.  
  10. if ( isset( $args[wp_error] ) && $args[wp_error] ) { 
  11. return new WP_Error( 'cmb2_get_oembed_result', $wp_error, compact( 'oembed', 'args' ) ); 
  12.  
  13. // Otherwise, send backerrorinfo that no oEmbeds were found 
  14. return '<p class="ui-state-error-text">' . $error . '</p>';