| @@ 85-95 (lines=11) @@ | ||
| 82 | ||
| 83 | public function getNodes() |
|
| 84 | { |
|
| 85 | if ($this->nodes instanceof \Closure) { |
|
| 86 | $nodes = ($this->nodes)(); |
|
| 87 | } elseif (is_string($this->nodes) || $this->nodes instanceof Model) { |
|
| 88 | $nodes = $this->setNodesFromModel(); |
|
| 89 | } elseif (is_array($this->nodes)) { |
|
| 90 | $nodes = $this->nodes; |
|
| 91 | } else { |
|
| 92 | throw new InvalidArgumentException( |
|
| 93 | "The form tree element's nodes must be return array" |
|
| 94 | ); |
|
| 95 | } |
|
| 96 | ||
| 97 | return $nodes; |
|
| 98 | } |
|
| @@ 64-74 (lines=11) @@ | ||
| 61 | ||
| 62 | public function getOptions() |
|
| 63 | { |
|
| 64 | if ($this->options instanceof \Closure) { |
|
| 65 | $options = ($this->options)(); |
|
| 66 | } elseif (is_string($this->options) || $this->options instanceof Model) { |
|
| 67 | $options = $this->setOptionsFromModel(); |
|
| 68 | } elseif (is_array($this->options)) { |
|
| 69 | $options = $this->options; |
|
| 70 | } else { |
|
| 71 | throw new InvalidArgumentException( |
|
| 72 | "The form select element's options must be return array(key=>value)" |
|
| 73 | ); |
|
| 74 | } |
|
| 75 | ||
| 76 | $this->extraOptions->each(function ($value, $key) use ($options) { |
|
| 77 | $options[$key] = $value; |
|