private function buildCommand($attribute, array $propertyData)
    {
        if ($attribute->get('check_listview') == 1) {
            $commandName = 'listviewtoggle_' . $attribute->getColName();
        } else {
            $commandName = 'publishtoggle_' . $attribute->getColName();
        }
        $toggle = new ToggleCommand();
        $toggle->setName($commandName);
        $toggle->setLabel($GLOBALS['TL_LANG']['MSC']['metamodelattribute_checkbox']['toggle'][0]);
        $toggle->setDescription(
            \sprintf(
                $GLOBALS['TL_LANG']['MSC']['metamodelattribute_checkbox']['toggle'][1],
                $attribute->getName()
            )
        );
        $extra           = $toggle->getExtra();
        $extra['icon']   = 'visible.svg';
        $objIconEnabled  = FilesModel::findByUuid($attribute->get('check_listviewicon'));
        $objIconDisabled = FilesModel::findByUuid($attribute->get('check_listviewicondisabled'));

        if ($attribute->get('check_listview') == 1 && $objIconEnabled->path && $objIconDisabled->path) {
            $extra['icon']          = $objIconEnabled->path;
            $extra['icon_disabled'] = $objIconDisabled->path;
        } else {
            $extra['icon'] = 'visible.svg';
        }

        $toggle->setToggleProperty($attribute->getColName());

        if ($attribute->get('check_inverse') == 1) {
            $toggle->setInverse(true);
        }

        if (!empty($propertyData['eval']['readonly'])) {
            $toggle->setDisabled(true);
        }

        return $toggle;
    }