Example #1
0
 /**
  * Open a section. Optionally is possible to use a custom section class.
  *
  * @param string $name  Section id
  * @param string $class Custom class name
  */
 public function section($name, $class = null)
 {
     /** @var \Foil\Contracts\SectionInterface $section */
     $section = $this->factory->factory($name, $this->mode(), $class);
     $section->start();
     $this->stack->push($section);
     $this->names->push($name);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function supply($section, $default = '')
 {
     if ($this->sections->has($section)) {
         return $this->sections->get($section)->content();
     }
     while (is_callable($default)) {
         $default = $default($section, $this);
     }
     return is_string($default) ? $default : '';
 }