List > Item * @copyright Tamaranga */ class ListItemBlock extends Block { /** @var array item data */ public $item = []; /** @var array block attributes */ public $attr = []; /** @var bool show item address */ public $showAddr = false; /** @var string Item images view: cover, contain */ public $imagesView = 'cover'; public function init() { parent::init(); $this->setTemplate('lists/list.item', 'listings'); } public function data() { $data = parent::data(); if (empty($this->item)) { return false; } if (empty($this->item['id'])) { return false; } $data['attr'] = [ 'class' => 'j-item', 'data-id' => $this->item['id'], ]; $address = []; if (! empty($this->item['city_title'])) { $address[] = $this->item['city_title']; } if (! empty($this->item['district_title'])) { $address[] = $this->item['district_title']; } if ($this->showAddr && ! empty($this->item['addr_addr'])) { $address[] = $this->item['addr_addr']; } $data['address'] = $address; return $data; } }