src/Charcoal/Admin/Property/AbstractSelectableInput.php
public function setEmptyChoice($choice)
    {
        if (is_string($choice) || ($choice instanceof Translation)) {
            $choice = [
                'label' => $choice
            ];
        }

        if (is_array($choice)) {
            $choice = array_replace_recursive(
                $this->defaultEmptyChoice(),
                $choice
            );
        } else {
            throw new InvalidArgumentException(sprintf(
                'Empty choice must be an array, received %s',
                (is_object($choice) ? get_class($choice) : gettype($choice))
            ));
        }

        if (!$choice['label'] instanceof Translation) {
            $choice['label'] = $this->translator()->translation($choice['label']);
        }

        $this->emptyChoice = $choice;

        return $this;
    }
public function setEmptyChoice($choice)
    {
        if (is_string($choice) || ($choice instanceof Translation)) {
            $choice = [
                'label' => $choice
            ];
        }

        if (is_array($choice)) {
            $choice = array_replace_recursive(
                $this->defaultEmptyChoice(),
                $choice
            );
        } else {
            throw new InvalidArgumentException(sprintf(
                'Empty choice must be an array, received %s',
                (is_object($choice) ? get_class($choice) : gettype($choice))
            ));
        }

        if (!$choice['label'] instanceof Translation) {
            $choice['label'] = $this->translator()->translation($choice['label']);
        }

        $this->emptyChoice = $choice;

        return $this;
    }
public function setEmptyChoice ( $ choice ) { if ( is_string ( $ choice ) || ( $ choice instanceof Translation ) ) { $ choice = [ 'label' => $ choice ] ; } if ( is_array ( $ choice ) ) { $ choice = array_replace_recursive ( $ this -> defaultEmptyChoice ( ) , $ choice ) ; } else { throw new InvalidArgumentException ( sprintf ( 'Empty choice must be an array, received %s' , ( is_object ( $ choice ) ? get_class ( $ choice ) : gettype ( $ choice ) ) ) ) ; } if ( ! $ choice [ 'label' ] instanceof Translation ) { $ choice [ 'label' ] = $ this -> translator ( ) -> translation ( $ choice [ 'label' ] ) ; } $ this -> emptyChoice = $ choice ; return $ this ; }
Set the empty option's structure.

@param  array|string $choice The property value.
@throws InvalidArgumentException If the choice structure is invalid.
@return PropertyInputInterface Chainable
Set the empty option s structure .