Skip to content

Commit

Permalink
Fix remove behavour with radio
Browse files Browse the repository at this point in the history
  • Loading branch information
bittrframework committed Jun 3, 2019
1 parent b57941a commit c91f3f0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,20 +828,20 @@ public function move(string $before = null, int $index = null): Form
*/
public function remove(string $name = null, int $index = null): Form
{
if (! $index)
if ($index)
{
foreach ($this->buffer as $i => $el)
unset($this->buffer[$index]);
return $this;
}

foreach ($this->buffer as $i => $el)
{
if (isset($el['name']) && $el['name'] == $name)
{
if (isset($el['name']) && $el['name'] == $name)
{
$index = $i;
break;
}
unset($this->buffer[$i]);
}
}

unset($this->buffer[$index]);

return $this;
}

Expand Down

0 comments on commit c91f3f0

Please sign in to comment.