'title',
'ARTIST' => 'artist',
'DATE' => 'date',
'IMAGE' => 'img',
'CATALOGUE' => 'cat',
'PRICE' => 'price',
'LINK' => 'link'
);
public $values;
protected $layout;
protected $layouts = array(
'default' => 'view_in_toc',
'toc' => 'view_in_toc'
);
function __construct($keys,$config) {
parent::__construct($keys,$config);
}
function simple() {
return sprintf("sdsd");
}
function affiliate_link($href) {
$classes = ['affiliate'];
$name = $href;
if (stripos($href, 'bandcamp.com') !== false) {
$classes[] = 'bandcamp';
$name = 'Bandcamp';
}
return sprintf('%s',
$href,
implode(" ",$classes),
$name
);
}
function view_in_toc() {
$f3 = \Base::instance();
$v = (object) $this->values;
$img = new CachedImage($this->config['path'].$v->img);
$img_html = sprintf('', $img->get_src(1000));
$ED = new ElementDispatcher();
$buy_button = $v->price
? $ED->content_element([
'buy',
$v->cat .": ".$v->title,
$v->price])
: "";
$affiliates = "";
if (is_array($v->link)) {
foreach ($v->link as $link) {
$affiliates .= $this->affiliate_link($link);
}
} else {
$affiliates .= $this->affiliate_link($v->link);
}
return sprintf(
"