Skip to content

Instantly share code, notes, and snippets.

@splittingred
Created September 7, 2011 16:11
Show Gist options
  • Save splittingred/1200989 to your computer and use it in GitHub Desktop.
Save splittingred/1200989 to your computer and use it in GitHub Desktop.
<?php
/**
* @var modX $modx
* @var modTemplateVar $this
* @var array $params
*
* @package modx
* @subpackage processors.element.tv.renders.mgr.input
*/
$modx->lexicon->load('tv_widget');
$modx->getService('fileHandler','modFileHandler', '', array('context' => $this->xpdo->context->get('key')));
/** @var modMediaSource $source */
$source = $this->getSource($modx->resource->get('context_key'));
if (!$source) return '';
if (!$source->getWorkingContext()) {
return '';
}
$source->setRequestProperties($_REQUEST);
$source->initialize();
$modx->controller->setPlaceholder('source',$source->get('id'));
$params = array_merge($source->getPropertyList(),$params);
if (!$source->checkPolicy('view')) {
$modx->controller->setPlaceholder('disabled',true);
$this->set('disabled',true);
$this->set('relativeValue',$this->get('value'));
} else {
$modx->controller->setPlaceholder('disabled',false);
$this->set('disabled',false);
$value = $this->get('value');
if (!empty($value)) {
$params['openTo'] = $source->getOpenTo($value,$params);
}
$this->set('relativeValue',$value);
}
$modx->controller->setPlaceholder('params',$params);
$modx->controller->setPlaceholder('tv',$this);
return $modx->controller->fetchTemplate('element/tv/renders/input/image.tpl');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment