/**
  * Adds a single context container to the top of the list
  * 
  * @param  string                                 $id Context Container ID
  * @param  string                                 $fn Context Container function
  * @return Ponticlaro\Bebop\Common\ContextManager     Context Manager instance
  */
 public function prepend($id, $fn)
 {
     if (is_string($id) && is_callable($fn)) {
         $this->contexts->unshift(new ContextContainer($id, $fn));
     }
     return $this;
 }
Example #2
0
 /**
  * Prepends a children to element
  * 
  * @param  mixed  $el HTML string or ElementAbstract
  * @return object     This class instance
  */
 public function prepend($el)
 {
     if (!$this->isSelfClosing()) {
         if (!is_string($el) && !$el instanceof ElementAbstract) {
             throw new \Exception('Element children must be either strings or children of \\Ponticlaro\\Bebop\\Html\\ElementAbstract.');
         }
         $this->config->unshift($el, 'children');
     }
     return $this;
 }