Adds a new dropdown element
@param string $identifier
@param array $items
@param string $label
@param string $value
@param boolean $multiple
@return HtmlFormDropdown
772719
public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
	}
1025473
public function createFromArray(array $identifiers)
    {
        foreach ($identifiers as $identifier) {
            $this->collection->add(Identifier::fromString($identifier));
        }

        return $this->collection;
    }
1115502
private function processConfig(string $identifier, array $config): array
    {
        $collections = [];
        $forms = [];
        $viewTypes = [];

        if (isset($config['collections'])) {
            foreach ($config['collections'] as $collectionIdentifier => $collectionConfig) {
                $collections[$collectionIdentifier] = Collection::fromArray(
                    [
                        'identifier' => $collectionIdentifier,
                        'validItemTypes' => $collectionConfig['valid_item_types'],
                        'validQueryTypes' => $collectionConfig['valid_query_types'],
                    ]
                );
            }
        }

        if (isset($config['forms'])) {
            foreach ($config['forms'] as $formIdentifier => $formConfig) {
                if (!$formConfig['enabled']) {
                    continue;
                }

                $forms[$formIdentifier] = Form::fromArray(
                    [
                        'identifier' => $formIdentifier,
                        'type' => $formConfig['type'],
                    ]
                );
            }
        }

        if (isset($config['view_types'])) {
            foreach ($config['view_types'] as $viewTypeIdentifier => $viewTypeConfig) {
                if (!$viewTypeConfig['enabled']) {
                    continue;
                }

                $itemViewTypes = [];

                if (!is_array($viewTypeConfig['item_view_types'] ?? [])) {
                    $viewTypeConfig['item_view_types'] = [];
                }

                if (!isset($viewTypeConfig['item_view_types']['standard'])) {
                    $viewTypeConfig['item_view_types']['standard'] = [
                        'name' => 'Standard',
                        'enabled' => true,
                    ];
                }

                foreach ($viewTypeConfig['item_view_types'] as $itemViewTypeIdentifier => $itemViewTypeConfig) {
                    if (!$itemViewTypeConfig['enabled']) {
                        continue;
                    }

                    $itemViewTypes[$itemViewTypeIdentifier] = ItemViewType::fromArray(
                        [
                            'identifier' => $itemViewTypeIdentifier,
                            'name' => $itemViewTypeConfig['name'],
                        ]
                    );
                }

                if (count($itemViewTypes) === 0) {
                    throw new RuntimeException(
                        sprintf(
                            'You need to specify at least one enabled item view type for "%s" view type and "%s" block definition.',
                            $viewTypeIdentifier,
                            $identifier
                        )
                    );
                }

                $viewTypes[$viewTypeIdentifier] = ViewType::fromArray(
                    [
                        'identifier' => $viewTypeIdentifier,
                        'name' => $viewTypeConfig['name'] ?? '',
                        'itemViewTypes' => $itemViewTypes,
                        'validParameters' => $viewTypeConfig['valid_parameters'] ?? null,
                    ]
                );
            }
        }

        if (count($viewTypes) === 0) {
            throw new RuntimeException(
                sprintf(
                    'You need to specify at least one enabled view type for "%s" block definition.',
                    $identifier
                )
            );
        }

        return [
            'name' => $config['name'] ?? '',
            'icon' => $config['icon'] ?? '',
            'isTranslatable' => $config['translatable'] ?? false,
            'collections' => $collections,
            'forms' => $forms,
            'viewTypes' => $viewTypes,
        ];
    }
832077
protected function addElement_select ($name, $label, $customElementConfig=array())
    {
        $defaultElementConfig = array(
            'name'       => $name,
            'attributes' => array(
                'id'         => $name,
            ),
            'options'    => array(
                'label'      => $label,
            ),
        );
        $elementConfig = array_replace_recursive(
            $defaultElementConfig,
            $customElementConfig
        );

        $this->addElement_select_configArray($elementConfig);
    }
1149630
public static function OptionGroup( $label, $options, $selected = NULL )
	{
		$attributes	= array( 'label' => $label );
		$options	= self::Options( $options, $selected );
		return UI_HTML_Tag::create( "optgroup", $options, $attributes );
	}
260956
function (items) {
		
			var i, length;
		
			// remove previous <option>s nodes
			while (this.el.childNodes.length > 0) {
				this.el.removeChild(this.el.childNodes[0]);
			}
		
			// add new options
			for (i = 0, length = items.length; i < length ; i += 1) {
				this.addChoice({ value: items[i][this.options.valueKey], label: items[i][this.options.labelKey] });
			}
		}
361135
public function addItemsPerPageSelector($items = [10, 25, 50, 100], $label = 'Item per pages:')
    {
        if ($ipp = $this->container->stickyGet('ipp')) {
            $this->ipp = $ipp;
        } else {
            $this->ipp = $items[0];
        }

        $pageLength = $this->paginator->add(['ItemsPerPageSelector', 'pageLengthItems' => $items, 'label' => $label, 'currentIpp' => $this->ipp], 'afterPaginator');
        $this->paginator->template->trySet('PaginatorType', 'ui grid');

        if ($sortBy = $this->getSortBy()) {
            $pageLength->stickyGet($this->name.'_sort', $sortBy);
        }

        $pageLength->onPageLengthSelect(function ($ipp) use ($pageLength) {
            $this->ipp = $ipp;
            $this->setModelLimitFromPaginator();
            //add ipp to quicksearch
            if ($this->quickSearch instanceof jsSearch) {
                $this->container->js(true, $this->quickSearch->js()->atkJsSearch('setUrlArgs', ['ipp', $this->ipp]));
            }
            $this->applySort();

            //return the view to reload.
            return $this->container;
        });

        return $this;
    }
24327
public function createItem($label = null, $href = null)
    {
        $link = new Link($label, $href);
        $link->attributes->addAttributeClass('dropdown-item');

        $this->childNodes->push($link);

        return $this->childNodes->last();
    }
656967
public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) {
		return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick));
	}
178013
public function addLabelDate($name, $label = '')
    {
        $e = new \FrenchFrogs\Form\Element\LabelDate($name, $label);
        $this->addElement($e);

        return $e;
    }
511838
public function addChoice($choice, $label = null)
    {
        $label ?: $label = $choice;
        $this->choices[$choice] = $label;
        return $this;
    }
1344791
public static function radioList($name, $selection = null, $items = [], $options = [])
    {
        if (!isset($options['item'])) {
            $itemOptions = ArrayHelper::remove($options, 'itemOptions', []);
            $encode = ArrayHelper::getValue($options, 'encode', true);
            $options['item'] = function ($index, $label, $name, $checked, $value) use ($itemOptions, $encode) {
                $options = array_merge([
                    'label' => $encode ? static::encode($label) : $label,
                    'value' => $value
                ], $itemOptions);
                return '<div class="radio">' . static::radio($name, $checked, $options) . '</div>';
            };
        }

        return parent::radioList($name, $selection, $items, $options);
    }
633400
public function set($identifier, $value)
    {
        $attributes = $this->getData()->attributes;
        $attributes[$identifier] = $value;

        return $this;
    }
358607
public function addSelect($name, $label, $multi = [],  $is_mandatory = true)
    {
        $e = new \FrenchFrogs\Form\Element\Select($name, $label, $multi);
        $this->addElement($e);

        if ($is_mandatory) {
            $e->addRule('required');
        } else {
            $e->addFilter('nullable');
        }

        return $e;
    }
191862
public function renderDropDownItem($item, &$active = false)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $subItems = ArrayHelper::getValue($item, 'items');

        $options = ArrayHelper::getValue($item, 'options', []);
        $active = $this->isItemActive($item);

        $item['linkOptions'] = ['class' => 'dropdown-toggle'];
        if (is_array($subItems)) {
            if ($this->activateItems) {
                $subItems = $this->isChildActive($subItems, $active);
            }
            $subItems = $this->renderSubItems($subItems, $active);
        }
        if ($this->activateItems && $active) {
            Html::addCssClass($options, 'active open');
        }
        $linkHtml = $this->renderItemLink($item);


        return Html::tag('li', $linkHtml . $subItems, $options);
    }
1058650
public function addFields($fields=NULL, $label=NULL) {
		if (isset($fields)) {
			if (!$fields instanceof HtmlFormFields) {
				if (!\is_array($fields)) {
					$fields=\func_get_args();
					$end=\end($fields);
					if (\is_string($end)) {
						$label=$end;
						\array_pop($fields);
					} else
						$label=NULL;
				}
				$this->_fields=\array_merge($this->_fields, $fields);
				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
			}
			if (isset($label)){
				$fields->wrap("<div class='field'><label>{$label}</label>","</div>");
			}
		} else {
			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
		}
		$this->addItem($fields);
		return $fields;
	}
958807
public function createOption($label, $value = null, $selected = false)
    {
        $option = new Option();
        $option->textContent->push($label);

        if (isset($value)) {
            $option->attributes->addAttribute('value', $value);
        }

        if ($selected) {
            $option->selected();
        }

        $this->childNodes->push($option);

        return $this->childNodes->last();
    }