/** * 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); }
/** * @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 : ''; }