<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Core_View_Helper_LinkRichContent extends Engine_View_Helper_HtmlImage {

  protected $_allowTyes = array(
    'player',
    'image',
    'reader',
    'survey',
    'file'
  );
  
	public function linkRichContent(Core_Model_Link $item) {
    if( empty($item->params['iframely']) ) {
      return;
    }
    try {
			if(!is_string($item->params['iframely']))
				throw new Exception("");
			$iframely = json_decode($item->params['iframely'], true);
    } catch (Exception $e) {
			$iframely = $item->params['iframely'];
    }
    $typeOfContent = array_intersect(array_keys($iframely['links']), $this->_allowTyes);
    if( empty($typeOfContent) || empty($iframely['html']) ) {
      return;
    }
    return $this->view->partial(
        'link/_richContent.tpl', 'core', array('link' => $item)
    );
  }
}
