protected function generateToggleCommand($commands, $attribute, $commandName, $class, $language)
    {
        if (!$commands->hasCommandNamed($commandName)) {
            $toggle = new TranslatedToggleCommand();
            $toggle
                ->setLanguage($language)
                ->setToggleProperty($attribute->getColName())
                ->setName($commandName)
                ->setLabel($GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][0])
                ->setDescription(
                    \sprintf(
                        $GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][1],
                        $attribute->getName(),
                        $language
                    )
                );

            $extra          = $toggle->getExtra();
            $extra['icon']  = 'visible.svg';
            $extra['class'] = $class;

            if ($commands->hasCommandNamed('show')) {
                $info = $commands->getCommandNamed('show');
            } else {
                $info = null;
            }
            $commands->addCommand($toggle, $info);
        }
    }
protected function generateToggleCommand($commands, $attribute, $commandName, $class, $language)
    {
        if (!$commands->hasCommandNamed($commandName)) {
            $toggle = new TranslatedToggleCommand();
            $toggle
                ->setLanguage($language)
                ->setToggleProperty($attribute->getColName())
                ->setName($commandName)
                ->setLabel($GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][0])
                ->setDescription(
                    \sprintf(
                        $GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][1],
                        $attribute->getName(),
                        $language
                    )
                );

            $extra          = $toggle->getExtra();
            $extra['icon']  = 'visible.svg';
            $extra['class'] = $class;

            if ($commands->hasCommandNamed('show')) {
                $info = $commands->getCommandNamed('show');
            } else {
                $info = null;
            }
            $commands->addCommand($toggle, $info);
        }
    }
protected function generateToggleCommand ( $ commands , $ attribute , $ commandName , $ class , $ language ) { if ( ! $ commands -> hasCommandNamed ( $ commandName ) ) { $ toggle = new TranslatedToggleCommand ( ) ; $ toggle -> setLanguage ( $ language ) -> setToggleProperty ( $ attribute -> getColName ( ) ) -> setName ( $ commandName ) -> setLabel ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'metamodelattribute_translatedcheckbox' ] [ 'toggle' ] [ 0 ] ) -> setDescription ( \ sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'metamodelattribute_translatedcheckbox' ] [ 'toggle' ] [ 1 ] , $ attribute -> getName ( ) , $ language ) ) ; $ extra = $ toggle -> getExtra ( ) ; $ extra [ 'icon' ] = 'visible.svg' ; $ extra [ 'class' ] = $ class ; if ( $ commands -> hasCommandNamed ( 'show' ) ) { $ info = $ commands -> getCommandNamed ( 'show' ) ; } else { $ info = null ; } $ commands -> addCommand ( $ toggle , $ info ) ; } }
Generate the toggle command information.

@param CommandCollectionInterface $commands    The already existing commands.

@param IAttribute                 $attribute   The attribute.

@param string                     $commandName The name of the new command.

@param string                     $class       The name of the CSS class for the command.

@param string                     $language    The language name.

@return void

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Generate the toggle command information .