Obtain separately hidden and visible field
@see TbInputVertical::checkBox
@see TbInputHorizontal::checkBox
@see TbInputVertical::radioButton
@see TbInputHorizontal::radioButton
@throws CException
@return array
976272
protected function getSeparatedSelectableInput()
	{
		switch ($this->type)
		{
			case self::TYPE_CHECKBOX:
				$method = 'checkBox';
				break;
			case self::TYPE_RADIO:
				$method = 'radioButton';
				break;
			default:
				throw new CException('This method can be used with only selectable control', E_USER_ERROR);
		}

		$control = $this->form->{$method}($this->model, $this->attribute, $this->htmlOptions);
		$hidden  = '';

		$hasHiddenField = (array_key_exists('uncheckValue', $this->htmlOptions) && $this->htmlOptions['uncheckValue'] === null)
			? false
			: true;

		if ($hasHiddenField && preg_match('/\<input .*?type="hidden".*?\/\>/', $control, $matches))
		{
			$hidden = $matches[0];
			$control = str_replace($hidden, '', $control);
		}

		return array($hidden, $control);
	}
365226
public function addRadioButton(CheckBox $radioButton)
    {
        if (!in_array($radioButton, $this->radioButtons, true)) {
            array_push($this->radioButtons, $radioButton);
        }
        return $this;
    }
1334902
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Field Objects:
        
        $fields->fieldByName('Root.Options.TitleOptions')->push(
            CheckboxField::create(
                'UseLevelTitle',
                $this->fieldLabel('UseLevelTitle')
            )
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'NavigationOptions',
                $this->fieldLabel('NavigationOptions'),
                [
                    DropdownField::create(
                        'SortBy',
                        $this->fieldLabel('SortBy'),
                        $this->getSortByOptions()
                    ),
                    CheckboxField::create(
                        'ShowCount',
                        $this->fieldLabel('ShowCount')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
999394
public function getHtmlFields()
    {
        $htmlFields = '';

        foreach ($this->fields as $field) {
            if (!$field->isOnFormView) {
                continue;
            }

            $parser = new ValidationParser($field->validationRules);

            if (in_array($field->htmlType, ['select', 'multipleSelect'])) {
                $htmlFields .= $this->getSelectHtmlField($field, $parser);
            } elseif (in_array($field->htmlType, ['radio', 'checkbox'])) {
                $htmlFields .= $this->getPickItemsHtml($field, $parser);
            } elseif ($field->htmlType == 'textarea') {
                $htmlFields .= $this->getTextareaHtmlField($field, $parser);
            } elseif ($field->htmlType == 'password') {
                $htmlFields .= $this->getPasswordHtmlField($field, $parser);
            } elseif ($field->htmlType == 'file') {
                $htmlFields .= $this->getFileHtmlField($field);
            } elseif ($field->htmlType == 'selectRange') {
                $htmlFields .= $this->getSelectRangeHtmlField($field);
            } elseif ($field->htmlType == 'selectMonth') {
                $htmlFields .= $this->getSelectMonthHtmlField($field);
            } else {
                $htmlFields .= $this->getStandardHtmlField($field, $parser);
            }
        }

        $this->replaceStandardLabels($htmlFields, $this->viewLabels->getLabels());

        return $htmlFields;
    }
1154135
public function getPrivateVisibleFacets()
    {
        $visibleFacets = $this->getVisibleFacets();
        $visibleByOwner = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')
            ->findBy(array('isVisibleByOwner' => true));
        $private = [];

        foreach ($visibleByOwner as $visible) {
            $private[$visible->getPosition()] = array(
                'position' => $visible->getPosition(),
                'id' => $visible->getId(),
                'name' => $visible->getName(),
                'canOpen' => true,
                'panels' => $visible->getPanelFacets()
            );
        }

        $data = [];

        //merge both array and set canOpen to true when needed
        foreach ($private as $el) {
            $found = false;

            foreach ($visibleFacets as $facet) {
                if ($el['id'] === $facet['id']) {
                    $canOpen = $facet['canOpen'] | $el['canOpen'];
                    $data[] = array(
                        'position' => $facet['position'],
                        'id' => $facet['id'],
                        'name' => $facet['name'],
                        'canOpen' => $canOpen,
                        'panels' => $facet['panels']
                    );
                    $found = true;
                }
            }

            if (!$found) {
                $data[$el['position']] = $el;
            }
        }

        $array = $data + $visibleFacets;
        ksort($array);

        return $array;
    }
669282
public function renderToggleButton()
    {
        if ($this->toggleButton !== null) {
            $tag   = ArrayHelper::removeValue($this->toggleButton, 'tag', 'button');
            $label = ArrayHelper::removeValue($this->toggleButton, 'label', 'Show');
            if ($tag === 'button' && !isset($this->toggleButton['type'])) {
                $this->toggleButton['type'] = 'button';
            }
            $this->toggleButton['data-reveal-id'] = $this->getId();
            return \CHtml::tag($tag, $this->toggleButton, $label);
        } else {
            return null;
        }
    }
356721
protected function getEditHtmlSelect()
    {
        /** @var AdminBaseHelper $linkedHelper */
        $linkedHelper = $this->getSettings('HELPER');
        $inputSize = (int) $this->getSettings('INPUT_SIZE');
        $windowWidth = (int) $this->getSettings('WINDOW_WIDTH');
        $windowHeight = (int) $this->getSettings('WINDOW_HEIGHT');

        $name = 'FIELDS';
        $key = $this->getCode();

        $entityData = $this->getOrmElementData();

        if (!empty($entityData)) {
            $elementId = $entityData[$linkedHelper::pk()];
            $elementName = $entityData[$this->getSettings('TITLE_FIELD_NAME')] ?
                $entityData[$this->getSettings('TITLE_FIELD_NAME')] :
                Loc::getMessage('IBLOCK_ELEMENT_NOT_FOUND');
        } else {
            $elementId = '';
        }

        $popupUrl = $linkedHelper::getUrl(array_merge(
            array(
                'popup' => 'Y',
                'eltitle' => $this->getSettings('TITLE_FIELD_NAME'),
                'n' => $name,
                'k' => $key
            ),
            $this->getSettings('ADDITIONAL_URL_PARAMS')
        ));

        return '<input name="' . $this->getEditInputName() . '"
                     id="' . $name . '[' . $key . ']"
                     value="' . $elementId . '"
                     size="' . $inputSize . '"
                     type="text">' .
        '<input type="button"
                    value="..." onClick="jsUtils.OpenWindow(\''. $popupUrl . '\', ' . $windowWidth . ', '
        . $windowHeight . ');">' . '&nbsp;<span id="sp_' . md5($name) . '_' . $key . '" >' .
        static::prepareToOutput($elementName)
        . '</span>';
    }
259684
public function radio($name, $label = null, $value = null, $checked = null, array $options = [])
    {
        $inputElement = $this->radioElement($name, $label, $value, $checked, false, $options);

        $wrapperOptions = $this->isHorizontal() ? ['class' => implode(' ', [$this->getLeftColumnOffsetClass(), $this->getRightColumnClass()])] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . '</div>';

        return $this->getFormGroup(null, $label, $wrapperElement);
    }
588814
public function radioButton(RadioButton $radioButton)
    {
        $label = new Tag('label');

        $tag = new Tag('input');
        $tag->setAttribute('type', 'checkbox');

        if ($radioButton->isChecked()) {
            $tag->setAttribute('checked', 'checked');
        }

        $tagHtml = $this->parseTag($tag, $radioButton);

        $label->setInnerHtml(
            $tagHtml . ' ' . ($radioButton->getLabel() ?: $radioButton->getTitle())
        );

        $div = new Tag('div');

        $cssClass = 'radio';
        if( $radioButton->isDisabled() ) {
            $cssClass .= ' disabled';
        }

        if ($radioButton->getForm()->isSubmitted()) {
            if (!$radioButton->isValid()) {
                $cssClass .= ' has-error has-feedback';
            } else {
                $cssClass .= ' has-success has-feedback';
            }
        }

        $div->setAttribute('class', $cssClass);
        $div->setInnerHtml($label->render());
        $html = $div->render();

        // if it's an horizontal form, then add some more classes
        if ($this->mode == self::MODE_HORIZONTAL) {
            $innerDiv = new Tag('div');
            $innerDiv->setAttribute('class', 'col-sm-offset-2 col-sm-10');
            $innerDiv->setInnerHtml($html);

            $outerDiv = new Tag('div');
            $outerDiv->setAttribute('class', 'form-group');
            $outerDiv->setInnerHtml($innerDiv->render());

            $html = $outerDiv->render();
        }

        return $html;
    }
733823
public function getWidgetData()
    {
        $arResult = [];

        switch ($this->type) {
            case self::TYPE_INPUT:
                $arResult = $this->getInputFieldSettings();
                break;
            case self::TYPE_NUMBER:
                $arResult = $this->getNumberFieldSettings();
                break;
            case self::TYPE_TEXT_AREA:
                $arResult = $this->getTextareaFieldSettings();
                break;
            case self::TYPE_RICH_EDITOR:
                $arResult = $this->getRichEditorFieldSettings();
                break;
            case self::TYPE_SINGLE_CHECKBOX:
                $arResult = $this->getSingleCheckboxFieldSettings();
                break;
            case self::TYPE_SWITCH:
                $arResult = $this->getSwitchFieldSettings();
                break;
            case self::TYPE_CHECKBOX:
                $arResult = $this->getCheckboxListSettings();
                break;
            case self::TYPE_BALLOON:
                $arResult = $this->getBalloonSettings();
                break;
            case self::TYPE_TAG_LIST:
                $arResult = $this->getTagListSettings();
                break;
            case self::TYPE_SELECT:
                $arResult = $this->getSelectSettings();
                break;
            case self::TYPE_RADIO:
                $arResult = $this->getRadioSettings();
                break;
            case self::TYPE_DATE:
                $arResult = $this->getDateSettings();
                break;
            case self::TYPE_COLOR_PICKER:
                $arResult = $this->getColorPickerSettings();
                break;
            /** FILE FINDER TYPE */
            case self::TYPE_MEDIA_FINDER:
                $arResult = $this->getMediaFinderSettings();
                break;
            default:
                return $arResult;
        }

        //Get common widget settings
        if (empty($arResult)) {
            return $arResult;
        }

        $arResult = array_merge($arResult, $this->getDefaultConfigSettings());

        return $arResult;
    }
1348321
protected function getInput()
	{
		$html = array();

		// Initialize some field attributes.
		$class = $this->element['class'] ? ' class="checkboxes ' . (string) $this->element['class'] . '"' : ' class="checkboxes"';
		$checkedOptions = explode(',', (string) $this->element['checked']);

		// Start the checkbox field output.
		$html[] = '<fieldset id="' . $this->id . '"' . $class . '>';

		// Get the field options.
		$options = $this->getOptions();

		// Build the checkbox field output.
		$html[] = '<ul>';

		foreach ($options as $i => $option)
		{
			// Initialize some option attributes.
			if (!isset($this->value) || empty($this->value))
			{
				$checked = (in_array((string) $option->value, (array) $checkedOptions) ? ' checked="checked"' : '');
			}
			else
			{
				$value = !is_array($this->value) ? explode(',', $this->value) : $this->value;
				$checked = (in_array((string) $option->value, $value) ? ' checked="checked"' : '');
			}

			$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
			$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';

			// Initialize some JavaScript option attributes.
			$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
			$label   = $this->translateLabel ? $this->getText()->translate($option->text) : $option->text;

			$html[] = '<li>';
			$html[] = '<input type="checkbox" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="'
				. htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';

			$html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . $label . '</label>';
			$html[] = '</li>';
		}

		$html[] = '</ul>';

		// End the checkbox field output.
		$html[] = '</fieldset>';

		return implode($html);
	}
735024
public function getVisibleColumns()
    {
        $columns = array();
        foreach ($this->columns as $column) {
            if ($column->visible) {
                $columns[] = $column;
            }
        }

        return $columns;
    }
1284984
protected function checkBox()
	{
		$attribute = $this->attribute;
		echo '<div class="controls">';
		echo '<label class="checkbox" for="' . $this->getAttributeId($attribute) . '">';
		echo $this->form->checkBox($this->model, $attribute, $this->htmlOptions) . PHP_EOL;
		echo $this->model->getAttributeLabel($attribute);
		echo $this->getError() . $this->getHint();
		echo '</label></div>';
	}
708417
public function form_radio($params) {
        if (!isset($params['field'])) {
            throw new \UnexpectedValueException("The field parameter is required.");
        }
        $value = isset($params['value']) ? $params['value'] : null;
        $attributes = isset($params['attrs']) ? $params['attrs'] : array();
        $checked = isset($params['checked']) ? $params['checked'] : null;
        return Form::checkbox($params['field'], $value, $checked, $attributes);
    }
576991
public function getVisibleColumns()
    {
        $definitions = $this->defineListColumns();
        $columns = [];

        /*
         * Supplied column list
         */
        if ($this->columnOverride === null) {
            $this->columnOverride = $this->getSession('visible', null);
        }

        if ($this->columnOverride && is_array($this->columnOverride)) {

            $invalidColumns = array_diff($this->columnOverride, array_keys($definitions));
            if (!count($definitions)) {
                throw new ApplicationException(Lang::get(
                    'backend::lang.list.missing_column',
                    ['columns'=>implode(',', $invalidColumns)]
                ));
            }

            $availableColumns = array_intersect($this->columnOverride, array_keys($definitions));
            foreach ($availableColumns as $columnName) {
                $definitions[$columnName]->invisible = false;
                $columns[$columnName] = $definitions[$columnName];
            }
        }
        /*
         * Use default column list
         */
        else {
            foreach ($definitions as $columnName => $column) {
                if ($column->invisible) {
                    continue;
                }

                $columns[$columnName] = $definitions[$columnName];
            }
        }

        return $this->visibleColumns = $columns;
    }
1091175
public function getKeysOfHiddenSubparts()
    {
        $keysToHide = [];

        foreach ($this->nodes as $key => $node) {
            if (!$node->isVisible()) {
                $keysToHide[] = $key;
            }
        }

        return $keysToHide;
    }
75089
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Style Fields:
        
        $style = [];
        
        // Create Column Span Field:
        
        if (self::framework()->useColumnSpan()) {
            
            $style[] = ViewportsField::create(
                'Span',
                $this->fieldLabel('Span'),
                $this->getColumnSpanOptions()
            );
            
        }
        
        // Create Column Offset Field:
        
        if (self::framework()->useColumnOffset()) {
            
            $style[] = ViewportsField::create(
                'Offset',
                $this->fieldLabel('Offset'),
                $this->getColumnOffsetOptions()
            );
            
        }
        
        // Add Style Fields to Tab:
        
        if (!empty($style)) {
            
            $fields->addFieldToTab(
                'Root.Style',
                FieldSection::create(
                    'ColumnStyle',
                    $this->fieldLabel('ColumnStyle'),
                    $style
                )
            );
            
        }
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ColumnOptions',
                $this->fieldLabel('ColumnOptions'),
                [
                    CheckboxField::create(
                        'Sidebar',
                        $this->fieldLabel('Sidebar')
                    ),
                    CheckboxField::create(
                        'HideEmpty',
                        $this->fieldLabel('HideEmpty')
                    ),
                    CheckboxField::create(
                        'EdgeToEdge',
                        $this->fieldLabel('EdgeToEdge')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }