/** * Build the buttons. * * @param TreeBuilder $builder * @param $entry * @return ButtonCollection */ public function build(TreeBuilder $builder, $entry) { $tree = $builder->getTree(); $buttons = new ButtonCollection(); $this->input->read($builder, $entry); foreach ($builder->getButtons() as $button) { if (!array_get($button, 'enabled', true)) { continue; } $button = $this->evaluator->evaluate($button, compact('entry', 'tree')); $button = $this->parser->parse($button, $entry); $button = $this->factory->make($button); $buttons->push($button); } return $buttons; }
/** * Build the buttons. * * @param TableBuilder $builder * @param $entry * @return ButtonCollection */ public function build(TableBuilder $builder, $entry) { $table = $builder->getTable(); $buttons = new ButtonCollection(); $this->input->read($builder); foreach ($builder->getButtons() as $button) { array_set($button, 'entry', $entry); $button = $this->evaluator->evaluate($button, compact('entry', 'table')); $button = $this->parser->parse($button, $entry); $button = $this->value->replace($button, $entry); $button = $this->factory->make($button); if (!$button->isEnabled()) { continue; } $buttons->push($button); } return $buttons; }
/** * Add a button to the buttons collection. * * @param ButtonInterface $button * @return $this */ public function addButton(ButtonInterface $button) { $this->buttons->push($button); return $this; }