Add elements to this form.
351286
public function definition() {
        $mform = $this->_form;

        $data = $this->_customdata['data'];
        $options = $this->_customdata['options'];

        $mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);
        $mform->addElement('hidden', 'returnurl', $data->returnurl);
        if (isset($data->emaillink)) {
            $emaillink = html_writer::link(new moodle_url('mailto:' . $data->emaillink), $data->emaillink);
            $mform->addElement('static', 'emailaddress', '',
                get_string('emailtoprivatefiles', 'moodle', $emaillink));
        }
        $mform->setType('returnurl', PARAM_LOCALURL);

        $this->add_action_buttons(true, get_string('savechanges'));

        $this->set_data($data);
    }
422004
private function buildElements(){

        $eles = $this->getElements();
        $groups = $this->elementsGroup($eles);
        $formNs = $this->formNs;

        $elementsHtml = '';
        foreach ($groups as $k=>$v){
            $elements = isset($v['elements']) ? $v['elements'] : null;
            if ($elements){

                if ($k != 'base'){
                    $elementsHtml .= '<fieldset class="'.$formNs.'form-field'.$k.'" id="'.$formNs.'form-field-'.$k.'" >';
                    if (isset($v['title']) && $v['title']){
                        $elementsHtml .= '<legend>'.$v['title'].'</legend>';
                    }

                }
                foreach ($elements as $ele){
                    $type = $ele['type'];
                    if ($type == 'text' || $type == 'hidden' || $type == 'password' || $type == 'email' || $type == 'file' || $type =='button' || $type == 'number'){
                        $elementsHtml .= $this->buildInput($ele);
                    }
                    if ($type == 'textarea') {
                        $elementsHtml .= $this->buildTextarea($ele);
                    }
                    if ($type == 'select'){
                        $elementsHtml .= $this->buildSelect($ele);
                    }
                    if ($type == 'radio'){
                        $elementsHtml .= $this->buildRadio($ele);
                    }
                    if ($type == 'checkbox'){
                        $elementsHtml .= $this->buildCheckbox($ele);
                    }
                    if ($type == 'submit' || $type == 'reset'){
                        $elementsHtml .= $this->buildSubmit($ele);
                    }
                }
                if ($k != 'base'){
                    $elementsHtml .= '</fieldset>';
                }


            }
        }




        return $elementsHtml;
    }
1231186
public function addElement(FormElement $element) {

		if(!empty($this->elements[$element->getName()])) {
			
			throw new HtmlFormException(sprintf("Element '%s' already assigned.", $element->getName()));
			
		}

		$this->elements[$element->getName()] = $element;
		$element->setForm($this);

		return $this;

	}
419822
private void addFirstChildElements() {
        for (Node node : nodes) {
            if (DOMHelper.getPreviousSiblingElement(node) == null) {
                result.add(node);
            }
        }
    }
781146
def append_elements(self, elements):
        
        self._elements = self._elements + list(elements)
        self._on_element_change()
1263928
def add_fields(self, form, index):
        
        super(ColumnFormSet, self).add_fields(form, index)
        form.fields['column'].choices = self.get_choices()
276223
def add_element(self, element):
        
        self.elements.append(element)
        self.type_graph.add_element(element)
541948
def fill_form(form, data):
    
    for (key, value) in data.items():
        if hasattr(form, key):
            if isinstance(value, dict):
                fill_form(getattr(form, key), value)
            else:
                getattr(form, key).data = value
    return form
31018
public function buildForm()
    {

        $this
            ->add('range', 'datepicker',
                [
                    'label'      => trans('expendable::form.date'),
                    'validation' => 'required',
                    'range'      => true
                ])
            ->add('type', 'choice', [
                'choices'    => StaticLabel::typeExport(),
                'validation' => 'required',
                'label'      => trans('expendable::form.type')
            ])
            ->addDefaultActions();
    }
381687
def addElement(self, parent, tag, value):
        """"""
        elem = self.rss.createElement(tag)
        node = self.rss.createTextNode(value)
        return parent.appendChild(elem).appendChild(node)
561663
protected function InitForm()
    {
        $this->repeater = $this->LoadElement();
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
103162
def _fill_form(form):
        
        clicked = False
        last_element = None
        for field in form:
            if field['text']:
                field['element'].clear()
                field['element'].send_keys(field['text'])
            if field['click']:
                field['element'].click()
                clicked = True
            last_element = field['element']
        if last_element:
            if not clicked:
                last_element.submit()
757035
private void addLastChildElements() {
        for (Node node : nodes) {
            if (DOMHelper.getNextSiblingElement(node) == null) {
                result.add(node);
            }
        }
    }
949173
public function definition() {
        $mform = $this->_form;

        list($assignment, $data, $params) = $this->_customdata;
        // Visible elements.
        $this->assignment = $assignment;
        $assignment->add_grade_form_elements($mform, $data, $params);

        if ($data) {
            $this->set_data($data);
        }
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
721451
public void addButtons()
    {
        this.addButton(Constants.BACK);
        this.addButton(Constants.GRID);
        this.addButton(Constants.SUBMIT);
        this.addButton(Constants.RESET);
        this.addButton(Constants.DELETE);
        this.addButton(Constants.HELP);
    }
528308
function _createElements() {
        $attributes = $this->getAttributes();
        if (is_null($attributes)) {
            $attributes = array();
        }
        if (!isset($attributes['size'])) {
            $attributes['size'] = 3;
        }
        $this->_elements = array();
        // E_STRICT creating elements without forms is nasty because it internally uses $this
        $number = $this->createFormElement('text', 'number', get_string('time', 'form'), $attributes, true);
        $number->set_force_ltr(true);
        $this->_elements[] = $number;
        unset($attributes['size']);
        $this->_elements[] = $this->createFormElement('select', 'timeunit', get_string('timeunit', 'form'), $this->get_units(), $attributes, true);
        // If optional we add a checkbox which the user can use to turn if on
        if($this->_options['optional']) {
            $this->_elements[] = $this->createFormElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
        }
        foreach ($this->_elements as $element){
            if (method_exists($element, 'setHiddenLabel')){
                $element->setHiddenLabel(true);
            }
        }
    }