Skip to content

Commit

Permalink
Reorder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Nov 14, 2022
1 parent 83a2727 commit b0e0c11
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/FormElement/SelectElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,6 @@ class SelectElement extends BaseFormElement
/** @var array|string Array when the attribute `multiple` is set to true, string otherwise */
protected $value;

public function getValueAttribute()
{
// select elements don't have a value attribute
return null;
}

public function getNameAttribute()
{
$name = $this->getName();

return $this->isMultiple() ? ($name . '[]') : $name;
}

public function getValue()
{
$value = parent::getValue();

return $this->isMultiple() ? (array) $value : $value;
}

/**
* Get the option with specified value
*
Expand Down Expand Up @@ -81,6 +61,26 @@ public function setOptions(array $options): self
return $this;
}

public function getValue()
{
$value = parent::getValue();

return $this->isMultiple() ? (array) $value : $value;
}

public function getValueAttribute()
{
// select elements don't have a value attribute
return null;
}

public function getNameAttribute()
{
$name = $this->getName();

return $this->isMultiple() ? ($name . '[]') : $name;
}

/**
* Make the selectOption for the specified value and the label
*
Expand Down

0 comments on commit b0e0c11

Please sign in to comment.