public function create($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { if (is_string($data)) { $this->setUnless($data, 'name', $data); } return parent::create($data, $options, $keyRemaps, $valueRemaps); }
public function __toString() { $o = $this->options(); if (!$this->isDirty($o, 'htmlAttributes.onclick', $emptyIsDirty = false)) { unset($o['htmlAttributes']['onclick']); } $this->options($o); return parent::__toString(); }
public function create($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { if (is_string($data) && is_string($options)) { $this->setUnless($data, 'title', $data); $this->setUnless($data, 'content', $options); $options = []; } return parent::create($data, $options, $keyRemaps, $valueRemaps); }
public function __toString() { $result = []; $result[] = $this->Title->toString(); $data = $this->data(); $this->setUnless($data, $this->_contentToken, ':content'); $data[$this->_contentToken] = implode(PHP_EOL, $result) . PHP_EOL . $data[$this->_contentToken]; $this->data($data); return parent::__toString(); }
public function __toString() { $result = []; $result[] = (string) $this->Title; $result[] = (string) $this->Body; $options = $this->options(); $options[$this->_contentToken] = implode(PHP_EOL, $result); $this->options($options); return parent::__toString(); }
/** * __toString() override for Multipart entities that will loop through it's component parts and get thier string values * before adding it to the content array and calling parent::__toString() * * @return string */ public function __toString() { $result = []; foreach ($this->parts as $key => $value) { if (is_integer($key) && is_string($value)) { $result[] = (string) $this->{$value}; } elseif (is_string($key) && is_string($value)) { $result[] = (string) $this->{$key}; } } $options = $this->options(); $options[$this->_contentToken] = implode(PHP_EOL, $result); $this->options($options); return parent::__toString(); }
public function create($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { if (is_string($data) && (is_string($options) || is_numeric($options))) { $this->setUnless($data, 'label', $data); $this->setUnless($data, 'current', $options); $options = []; } #DEFAULTS $this->setUnless($data, 'current', 0); $this->setUnless($data, 'prefix', ''); $this->setUnless($data, 'label', '(:current/:max)'); $this->setUnless($data, 'suffix', ''); $this->setUnless($data, 'min', 0); $this->setUnless($data, 'max', 100); $this->setUnless($data, 'context', 'success'); #END DEFAULTS return parent::create($data, $options, $keyRemaps, $valueRemaps); }
public function create($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { if (is_string($data) && is_string($options)) { $this->setUnless($data, 'id', $data); $this->setUnless($data, 'content', $options); $options = []; } $this->setDefault($data, 'content', $data); $this->setUnless($data, 'id', $this->generateId()); return parent::create($data, $options, $keyRemaps, $valueRemaps); }
public function create($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { if (is_string($options)) { $this->setUnless($data, 'title', $data); $this->setUnless($data, 'body', $options); $options = []; } else { $this->setDefault($data, 'body', $data); } $this->setUnless($options, 'id', $this->getParentNode()->id); return parent::create($data, $options, $keyRemaps, $valueRemaps); }
public function testDisposable() { $Controller = new Controller(); $View = new View($Controller); $settings = ['tag' => 'p', 'htmlAttributes' => ['class' => 'foo', 'data-target' => 'bar']]; $t = new BootstrapHelperEntity($View, $settings); $t->create('Gimme Content'); $this->assertTag(['tag' => 'p', 'content' => 'Gimme Content', 'attributes' => ['class' => 'foo', 'data-target' => 'bar']], $t, 'Failed asserting $settings -> $_options conversion for disposable, pre-configured entities'); }
/** * Wrapper for BootstrapEntityHelper::create() that handles Collection-specific logic including the * storage of $this as the parent node of each of its child entities (tree based) * * @see BootstrapEntityHelper::create() * @param string $data * @param mixed $options * @param mixed $keyRemaps * @param mixed $valueRemaps * @return BootstrapHelperEntity (or subclass) */ public function add($data = '', $options = [], $keyRemaps = false, $valueRemaps = false) { #if this is the first time we've called add() on the collection, we need to create() it if (!$this->_wasCreated) { parent::create(); } $p = new $this->_entityClass($this->_view, $this->_settings); $p->create($data, $options, $keyRemaps, $valueRemaps); $this->entities[$p->id] = $p; $p->setParentNode($this); return $p; }