public static function renderOption($option, TranslatorInterface $translator = null) {

        if (null === $option) {
            return null !== $translator ? $translator->trans("label.empty_selection") : "Empty selection";
        }

        // Check the implementation.
        if (true === ($option instanceof TranslatedChoiceLabelInterface)) {
            $output = $option->getTranslatedChoiceLabel($translator);
        } else if (true === ($option instanceof ChoiceLabelInterface)) {
            $output = $option->getChoiceLabel();
        } else {
            $output = "This option must implements [Translated]ChoiceLabelInterface";
        }

        if (true === ($option instanceof AlphabeticalTreeNodeInterface)) {
            $multiplier = AlphabeticalTreeNodeHelper::getLevel($option);
            $nbsp       = html_entity_decode("&nbsp;");
            $symbol     = html_entity_decode(0 === $multiplier ? "&#9472;" : "&#9492;");
            $output     = implode("", [str_repeat($nbsp, $multiplier * 3), $symbol, $nbsp, $output]);
        }

        return $output;
    }
public static function renderOption($option, TranslatorInterface $translator = null) {

        if (null === $option) {
            return null !== $translator ? $translator->trans("label.empty_selection") : "Empty selection";
        }

        // Check the implementation.
        if (true === ($option instanceof TranslatedChoiceLabelInterface)) {
            $output = $option->getTranslatedChoiceLabel($translator);
        } else if (true === ($option instanceof ChoiceLabelInterface)) {
            $output = $option->getChoiceLabel();
        } else {
            $output = "This option must implements [Translated]ChoiceLabelInterface";
        }

        if (true === ($option instanceof AlphabeticalTreeNodeInterface)) {
            $multiplier = AlphabeticalTreeNodeHelper::getLevel($option);
            $nbsp       = html_entity_decode("&nbsp;");
            $symbol     = html_entity_decode(0 === $multiplier ? "&#9472;" : "&#9492;");
            $output     = implode("", [str_repeat($nbsp, $multiplier * 3), $symbol, $nbsp, $output]);
        }

        return $output;
    }
public static function renderOption ( $ option , TranslatorInterface $ translator = null ) { if ( null === $ option ) { return null !== $ translator ? $ translator -> trans ( "label.empty_selection" ) : "Empty selection" ; } // Check the implementation. if ( true === ( $ option instanceof TranslatedChoiceLabelInterface ) ) { $ output = $ option -> getTranslatedChoiceLabel ( $ translator ) ; } else if ( true === ( $ option instanceof ChoiceLabelInterface ) ) { $ output = $ option -> getChoiceLabel ( ) ; } else { $ output = "This option must implements [Translated]ChoiceLabelInterface" ; } if ( true === ( $ option instanceof AlphabeticalTreeNodeInterface ) ) { $ multiplier = AlphabeticalTreeNodeHelper :: getLevel ( $ option ) ; $ nbsp = html_entity_decode ( "&nbsp;" ) ; $ symbol = html_entity_decode ( 0 === $ multiplier ? "&#9472;" : "&#9492;" ) ; $ output = implode ( "" , [ str_repeat ( $ nbsp , $ multiplier * 3 ) , $ symbol , $ nbsp , $ output ] ) ; } return $ output ; }
Render an option.

@param mixed $option The option.
@param TranslatorInterface|null $translator The translator service.
@return string Returns the rendered option.
Render an option .