array(), 'suffix' => array() ); public static function getPageCSS() { return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css'); } /** * @param mixed $child */ protected function onAddChild($child) { if(is_string($child) && !$this->props->has('text')) { $this->props->set('text', $child); return false; } else { $this->props->addToList('titlePrefix', $child); return false; } } private function buildEntityID() { $entityID = $this->prop('entityID'); $className = $this->prop('idClass'); if(!isset($entityID)) return null; return idLabel::create($entityID, array('class' => $className)); } private function buildEntityName() { $text = $this->prop('text'); $level = $this->prop('level'); $className = $this->prop('textClass'); $href = $this->prop('href'); $labelProps = $this->prop('labelProps'); $titlePrefix = $this->prop('titlePrefix'); $titleClass = empty($level) ? 'entity-title' : "entity-title entity-title-$level"; if(empty($href)) return span ( setClass($titleClass, $className), set($labelProps), $titlePrefix, $text ); return a ( setClass($titleClass, $className), set::href($href), set($labelProps), $titlePrefix, $text ); } protected function build() { $reverse = $this->prop('reverse'); $prefix = $this->block('prefix'); $suffix = $this->block('suffix'); $entityID = $this->buildEntityID(); $entityName = $this->buildEntityName(); return div ( setClass('entity-label space-x-1.5 overflow-hidden nowrap flex items-center'), set($this->getRestProps()), $prefix, $reverse ? array($entityName, ' ', $entityID) : array($entityID, ' ', $entityName), $suffix ); } }