コード例 #1
0
 public function renderTeaserPicture(Teaser_Model_Item $item, array $box, $params = array())
 {
     if (!isset($box['params']['images'])) {
         return false;
     }
     $boxImages = $box['params']['images'];
     if (isset($params['css_class'])) {
         $cssClass = ' class="' . $params['css_class'] . '"';
     } else {
         $cssClass = '';
     }
     $html = '<picture' . $cssClass . '><!--[if IE 9]><video style="display: none;"><![endif]-->';
     foreach ($boxImages as $imageKey => $imageDef) {
         $path = $item->get_content($imageKey);
         if (isset($params['version'])) {
             $path .= '?v=' . $params['version'];
         }
         $html .= '<source srcset="' . $path . ' " media="' . $imageDef['media_query'] . '">';
     }
     $html .= '<!--[if IE 9]></video><![endif]--><img srcset="' . $path . '" alt="' . $this->view->escape($item->get_content('image_alt')) . '"></picture>';
     return $html;
 }
コード例 #2
0
 protected function addItemImageContent(Teaser_Model_Item $item, $imageKey, $prefix, $suffix, $ext)
 {
     $content = $item->get_content();
     if (isset($content[$imageKey])) {
         return;
     }
     $newFile = $prefix . $suffix . $ext;
     echo "{$newVal}\n";
     $content = $item->get_content();
     $content[$imageKey] = $newVal;
     $item->set_content($content);
 }