public function getDropDownField($emptystring = null, $values = null)
    {
        $values = ($values) ? $values : $this->Values()->sort(['Sort' => 'ASC', 'Value' => 'ASC']);

        if ($values->exists()) {
            $field = DropdownField::create(
                'ProductAttributes[' . $this->ID . ']',
                $this->Name,
                $values->map('ID', 'Value')
            );

            if ($emptystring) {
                $field->setEmptyString($emptystring);
            }

            return $field;
        }

        return null;
    }
public function getDropDownField($emptystring = null, $values = null)
    {
        $values = ($values) ? $values : $this->Values()->sort(['Sort' => 'ASC', 'Value' => 'ASC']);

        if ($values->exists()) {
            $field = DropdownField::create(
                'ProductAttributes[' . $this->ID . ']',
                $this->Name,
                $values->map('ID', 'Value')
            );

            if ($emptystring) {
                $field->setEmptyString($emptystring);
            }

            return $field;
        }

        return null;
    }
public function getDropDownField ( $ emptystring = null , $ values = null ) { $ values = ( $ values ) ? $ values : $ this -> Values ( ) -> sort ( [ 'Sort' => 'ASC' , 'Value' => 'ASC' ] ) ; if ( $ values -> exists ( ) ) { $ field = DropdownField :: create ( 'ProductAttributes[' . $ this -> ID . ']' , $ this -> Name , $ values -> map ( 'ID' , 'Value' ) ) ; if ( $ emptystring ) { $ field -> setEmptyString ( $ emptystring ) ; } return $ field ; } return null ; }
Returns a dropdown field for the user to select a variant.

@param string    $emptyString
@param ArrayList $values

@return DropdownField
Returns a dropdown field for the user to select a variant .