/** * Convert the class to data-* attribute friendly associative array * will become data-key="value" * Exclude values if default * * @return array associative array */ public function toHTMLDataArray() { $data = parent::toHTMLDataArray(); if (isset($this->recommendations) && $this->recommendations === true) { $data['recommendations'] = 'true'; } if (isset($this->filter)) { $data['filter'] = $this->filter; } return $data; }