/**
  * Adds the embed code field to the page.
  * @param $entity
  * @param $displayer
  */
 private function _add_embed_code($entity)
 {
     reason_include_once('classes/media/zencoder/media_work_displayer.php');
     $displayer = new ZencoderMediaWorkDisplayer();
     $displayer->set_media_work($entity);
     if ($entity->get_value('av_type') == 'Video') {
         $displayer->set_height('small');
         $embed_markup_small = $displayer->get_display_markup();
         $displayer->set_height('medium');
         $embed_markup_medium = $displayer->get_display_markup();
         $displayer->set_height('large');
         $embed_markup_large = $displayer->get_display_markup();
         if (!empty($embed_markup_small)) {
             $this->_show_embed_item('Small Embedding Code', $embed_markup_small);
             $this->_show_embed_item('Medium Embedding Code', $embed_markup_medium);
             $this->_show_embed_item('Large Embedding Code', $embed_markup_large);
         }
     } else {
         $displayer->set_height('small');
         $embed_markup_small = $displayer->get_display_markup();
         if (!empty($embed_markup_small)) {
             $this->_show_embed_item('Audio Embedding Code', $embed_markup_small);
         }
     }
 }
 /**
  * Adds some fields containing copy-paste-able embedding code.
  */
 function _add_embed_code()
 {
     if ($this->manager->get_value('transcoding_status') == 'ready') {
         reason_include_once('classes/media/zencoder/media_work_displayer.php');
         $displayer = new ZencoderMediaWorkDisplayer();
         $entity = new entity($this->manager->get_value('id'));
         $displayer->set_media_work($entity);
         if ($this->manager->get_value('av_type') == 'Video') {
             $displayer->set_height('small');
             $embed_markup_small = $displayer->get_display_markup();
             $displayer->set_height('medium');
             $embed_markup_medium = $displayer->get_display_markup();
             $displayer->set_height('large');
             $embed_markup_large = $displayer->get_display_markup();
             if (!empty($embed_markup_small)) {
                 $this->manager->add_element('embed_small', 'text', array('maxlength' => 9001));
                 $this->manager->set_value('embed_small', $embed_markup_small);
                 $this->manager->set_display_name('embed_small', 'Small Embed Code');
                 $this->manager->add_element('embed_medium', 'text', array('maxlength' => 9001));
                 $this->manager->set_value('embed_medium', $embed_markup_medium);
                 $this->manager->set_display_name('embed_medium', 'Medium Embed Code');
                 $this->manager->add_element('embed_large', 'text', array('maxlength' => 9001));
                 $this->manager->set_value('embed_large', $embed_markup_large);
                 $this->manager->set_display_name('embed_large', 'Large Embed Code');
             }
         } elseif ($this->manager->get_value('av_type') == 'Audio') {
             $embed_markup_small = $displayer->get_display_markup();
             if (!empty($embed_markup_small)) {
                 $this->manager->add_element('embed_small', 'text');
                 $this->manager->set_value('embed_small', $embed_markup_small);
                 $this->manager->set_display_name('embed_small', 'Audio Embedding Code');
             }
         }
     }
 }