used by clacoForm Manager.

@deprecated

@todo remove me
10409
public function createField($name, $isRequired, $type, ResourceNode $resourceNode = null)
    {
        $fieldFacet = new FieldFacet();
        $fieldFacet->setLabel($name);
        $fieldFacet->setType($type);
        $fieldFacet->setRequired($isRequired);
        $fieldFacet->setResourceNode($resourceNode);
        $this->om->persist($fieldFacet);
        $this->om->flush();

        return $fieldFacet;
    }
657143
function clean_fields( $fields )
	{
		// trim down the fields
		if( $fields )
		{
			foreach( $fields as $i => $field )
			{
				// unset unneccessary bits
				unset( $field['id'], $field['class'], $field['order_no'], $field['field_group'], $field['_name'] );
				
				
				// instructions
				if( !$field['instructions'] )
				{
					unset( $field['instructions'] );
				}
				
				
				// Required
				if( !$field['required'] )
				{
					unset( $field['required'] );
				}
				
				
				// conditional logic
				if( !$field['conditional_logic']['status'] )
				{
					unset( $field['conditional_logic'] );
				}
				
				
				// children
				if( isset($field['sub_fields']) )
				{
					$field['sub_fields'] = apply_filters('acf/export/clean_fields', $field['sub_fields']);
				}
				elseif( isset($field['layouts']) )
				{
					foreach( $field['layouts'] as $l => $layout )
					{
						$field['layouts'][ $l ]['sub_fields'] = apply_filters('acf/export/clean_fields', $layout['sub_fields']);
					}
				}

				
				// override field
				$fields[ $i ] = $field;
			}
		}
		
		return $fields;
	}
566025
public function definition() {
        $importer = $this->_customdata;

        $mform = $this->_form;
        $mform->addElement('hidden', 'confirm', 1);
        $mform->setType('confirm', PARAM_BOOL);
        $mform->addElement('hidden', 'importid', $importer->get_importid());
        $mform->setType('importid', PARAM_INT);

        $requiredheaders = $importer->list_required_headers();
        $foundheaders = $importer->list_found_headers();

        if (empty($foundheaders)) {
            $foundheaders = range(0, count($requiredheaders));
        }
        $foundheaders[-1] = get_string('none');

        foreach ($requiredheaders as $index => $requiredheader) {
            $mform->addElement('select', 'header' . $index, $requiredheader, $foundheaders);
            if (isset($foundheaders[$index])) {
                $mform->setDefault('header' . $index, $index);
            } else {
                $mform->setDefault('header' . $index, -1);
            }
        }

        $this->add_action_buttons(true, get_string('confirm', 'tool_lpimportcsv'));
    }
708922
public function attributesForModal()
    {
        // Remove some specific attributes.  Leaving empties in there so the updating
        // of values to NULL is displayed.
        $attributes = array_except($this->changed, [
            'id', 'updated_at', 'created_at', 'password', 'remember_token',
        ]);

        // Make more readable titles
        $out = [];
        foreach ($attributes as $key => $val) {
            $out[Text::titleFromKey($key)] = $val;
        }

        return $out;
    }
1135056
public function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($elementName, $elementLabel, $optgrps, $attributes, $showchoose);
    }
866826
function() {
		
		var columndefs = this.options.columnDefs || this.fieldsToColumndefs(this.options.fields);

    	// Adding modify column if we use form editing and if allowModify is true
      if(this.options.allowModify ) {
    	   columndefs = columndefs.concat([{
    	      key:'modify',
    	      label:' ',
    	      formatter:function(elCell) {
               elCell.innerHTML = msgs.modifyText;
               elCell.style.cursor = 'pointer';
            }
         }]);
      }
      
      // Adding delete column
      if(this.options.allowDelete) {
      	 columndefs = columndefs.concat([{
      	    key:'delete',
      	    label:' ',
      	    formatter:function(elCell) {
               elCell.innerHTML = msgs.deleteText;
               elCell.style.cursor = 'pointer';
            }
         }]);
      }
		
		return columndefs;
	}
1213583
public function Form()
    {
        $crumbs = $this->Breadcrumbs();
        
        if ($crumbs && $crumbs->count()>=2) {
            $one_level_up = $crumbs->offsetGet($crumbs->count()-2);
        }
        
        $record_ids = "";
        $query_string = "";
        $recordList = $this->getRecordIDList();
        
        foreach ($this->getRecordIDList() as $id) {
            $record_ids .= $id . ',';
            $query_string .= "records[]={$id}&";
        }
        
        // Cut off the last 2 parts of the string
        $record_ids = substr($record_ids, 0, -1);
        $query_string = substr($query_string, 0, -1);
        
        $form = new Form(
            $this,
            'Form',
            $fields = FieldList::create(
                HiddenField::create("RecordIDs", "", $record_ids),
                TagField::create(
                    'Tags',
                    null,
                    ContactTag::get()
                )->setDescription(_t(
                    "Contacts.TagDescription",
                    "List of tags related to this contact, seperated by a comma."
                ))->setShouldLazyLoad(true)
            ),
            $actions = FieldList::create(
                FormAction::create('doAddTags', _t("Contacts.Add", 'Add'))
                    ->setAttribute('id', 'bulkEditingSaveBtn')
                    ->addExtraClass('btn btn-success')
                    ->setAttribute('data-icon', 'accept')
                    ->setUseButtonTag(true),
                    
                FormAction::create('Cancel', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL', 'Cancel'))
                    ->setAttribute('id', 'bulkEditingUpdateCancelBtn')
                    ->addExtraClass('btn btn-danger cms-panel-link')
                    ->setAttribute('data-icon', 'decline')
                    ->setAttribute('href', $one_level_up->Link)
                    ->setUseButtonTag(true)
                    ->setAttribute('src', '')
            )
        );
        
        if ($crumbs && $crumbs->count() >= 2) {
            $form->Backlink = $one_level_up->Link;
        }
        
        // override form action URL back to bulkEditForm
        // and add record ids GET var
        $form->setFormAction(
            $this->Link('Form?records[]='.implode('&', $recordList))
        );

        return $form;
    }
927729
public function getFromForm()
    {
        if ($this->form !== null) {
            $this->notification_email = $this->form->notification_email;
            if ($this->form->full_name !== '') {
                $this->full_name = $this->form->full_name;
            }
            $this->display_name = $this->form->display_name;
            $this->tz = $this->form->tz;
            $this->location = TextHelper::clearText($this->form->location);
            $this->about = TextHelper::clearText($this->form->about);
            $this->custom_fields = $this->form->custom_fields;
        }
    }
1314467
public function clear()
    {
        if ($this->locked) {
            throw new AccessException('Options cannot be cleared from a lazy option or normalizer.');
        }

        $this->defined = [];
        $this->defaults = [];
        $this->nested = [];
        $this->required = [];
        $this->resolved = [];
        $this->lazy = [];
        $this->normalizers = [];
        $this->allowedTypes = [];
        $this->allowedValues = [];
        $this->deprecated = [];

        return $this;
    }
1044153
public function definition() {
        global $DB;

        $mform = $this->_form;

        list($instance, $plugin, $context, $type, $returnurl) = $this->_customdata;

        $mform->addElement('header', 'header', get_string('pluginname', 'enrol_' . $type));

        $plugin->edit_instance_form($instance, $mform, $context);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'courseid');
        $mform->setType('courseid', PARAM_INT);

        $mform->addElement('hidden', 'type');
        $mform->setType('type', PARAM_COMPONENT);
        $instance->type = $type;

        $mform->addElement('hidden', 'returnurl');
        $mform->setType('returnurl', PARAM_LOCALURL);
        $mform->setConstant('returnurl', $returnurl);

        $this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));

        $this->set_data($instance);
    }
356176
public function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($action, $customdata, $method, $target, $attributes, $editable);
    }
937663
private function dynamicFormCheck()
    {
        if ($this->field->hasDynamicForms()) {
            $this->dynamicFormParentName = $this->field->getName();
            $value = $this->field->getValue();
            $forms = $this->field->getDynamicForms();
            $this->includeDynamicFormJavascript = true;
            foreach ($forms as $dynamicTriggerValue => $form) {
                $this->dynamicFormVisible = ($value == $dynamicTriggerValue);
                $dynamicFields = $form->getFields();
                $this->processFields($dynamicFields, $dynamicTriggerValue);
            }
            unset($this->dynamicFormParentName);
        }
    }
1328741
public function Form()
    {
        $crumbs = $this->Breadcrumbs();
        
        if ($crumbs && $crumbs->count()>=2) {
            $one_level_up = $crumbs->offsetGet($crumbs->count()-2);
        }
        
        $record_ids = "";
        $query_string = "";
        $recordList = $this->getRecordIDList();
        
        foreach ($this->getRecordIDList() as $id) {
            $record_ids .= $id . ',';
            $query_string .= "records[]={$id}&";
        }
        
        // Cut off the last 2 parts of the string
        $record_ids = substr($record_ids, 0, -1);
        $query_string = substr($query_string, 0, -1);
        
        $form = new Form(
            $this,
            'Form',
            $fields = FieldList::create(
                HiddenField::create("RecordIDs", "", $record_ids),
                DropdownField::create(
                    "ContactListID",
                    _t("Contacts.ChooseList", "Choose a list"),
                    ContactList::get()->map()
                )->setEmptyString(_t("Contacts.SelectList", "Select a List"))
            ),
            $actions = FieldList::create(
                FormAction::create('doAddToList', _t("Contacts.Add", 'Add'))
                    ->setAttribute('id', 'bulkEditingSaveBtn')
                    ->addExtraClass('btn btn-success')
                    ->setAttribute('data-icon', 'accept')
                    ->setUseButtonTag(true),
                    
                FormAction::create('Cancel', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL', 'Cancel'))
                    ->setAttribute('id', 'bulkEditingUpdateCancelBtn')
                    ->addExtraClass('btn btn-danger cms-panel-link')
                    ->setAttribute('data-icon', 'decline')
                    ->setAttribute('href', $one_level_up->Link)
                    ->setUseButtonTag(true)
                    ->setAttribute('src', '')
            )
        );
        
        if ($crumbs && $crumbs->count() >= 2) {
            $form->Backlink = $one_level_up->Link;
        }
        
        // override form action URL back to bulkEditForm
        // and add record ids GET var
        $form->setFormAction(
            $this->Link('Form?records[]='.implode('&', $recordList))
        );

        return $form;
    }
876364
public function getFormatted()
    {
        if ($this->getUnit() != "") {
            return $this->getValue() . " " . $this->getUnit();
        } else {
            return (string)$this->getValue();
        }
    }
408587
public function ImportForm()
    {
        $modelSNG = singleton($this->modelClass);
        $modelName = $modelSNG->i18n_singular_name();
        // check if a import form should be generated
        if (!$this->showImportForm ||
            (is_array($this->showImportForm) && !in_array($this->modelClass, $this->showImportForm))
        ) {
            return false;
        }

        $importers = $this->getModelImporters();
        if (!$importers || !isset($importers[$this->modelClass])) {
            return false;
        }

        if (!$modelSNG->canCreate(Security::getCurrentUser())) {
            return false;
        }

        $fields = new FieldList(
            new HiddenField('ClassName', false, $this->modelClass),
            new FileField('_CsvFile', false)
        );

        // get HTML specification for each import (column names etc.)
        $importerClass = $importers[$this->modelClass];
        /** @var BulkLoader $importer */
        $importer = new $importerClass($this->modelClass);
        $spec = $importer->getImportSpec();
        $specFields = new ArrayList();
        foreach ($spec['fields'] as $name => $desc) {
            $specFields->push(new ArrayData(array('Name' => $name, 'Description' => $desc)));
        }
        $specRelations = new ArrayList();
        foreach ($spec['relations'] as $name => $desc) {
            $specRelations->push(new ArrayData(array('Name' => $name, 'Description' => $desc)));
        }
        $specHTML = $this->customise(array(
            'ClassName' => $this->sanitiseClassName($this->modelClass),
            'ModelName' => Convert::raw2att($modelName),
            'Fields' => $specFields,
            'Relations' => $specRelations,
        ))->renderWith($this->getTemplatesWithSuffix('_ImportSpec'));

        $fields->push(new LiteralField("SpecFor{$modelName}", $specHTML));
        $fields->push(
            new CheckboxField(
                'EmptyBeforeImport',
                _t('SilverStripe\\Admin\\ModelAdmin.EMPTYBEFOREIMPORT', 'Replace data'),
                false
            )
        );

        $actions = new FieldList(
            FormAction::create('import', _t('SilverStripe\\Admin\\ModelAdmin.IMPORT', 'Import from CSV'))
                ->addExtraClass('btn btn-outline-secondary font-icon-upload')
        );

        $form = new Form(
            $this,
            "ImportForm",
            $fields,
            $actions
        );
        $form->setFormAction(
            Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'ImportForm')
        );

        $this->extend('updateImportForm', $form);

        return $form;
    }
419851
protected function definition() {
        global $CFG;

        $mform = $this->_form;
        list($context, $capability, $overridableroles) = $this->_customdata;

        list($needed, $forbidden) = get_roles_with_cap_in_context($context, $capability->name);
        foreach ($needed as $id => $unused) {
            unset($overridableroles[$id]);
        }
        foreach ($forbidden as $id => $unused) {
            unset($overridableroles[$id]);
        }

        $mform->addElement('header', 'allowheader', get_string('roleallowheader', 'core_role'));

        $mform->addElement('select', 'roleid', get_string('roleselect', 'core_role'), $overridableroles);

        $mform->addElement('hidden', 'capability');
        $mform->setType('capability', PARAM_CAPABILITY);
        $mform->setDefault('capability', $capability->name);

        $mform->addElement('hidden', 'contextid');
        $mform->setType('contextid', PARAM_INT);
        $mform->setDefault('contextid', $context->id);

        $mform->addElement('hidden', 'allow');
        $mform->setType('allow', PARAM_INT);
        $mform->setDefault('allow', 1);

        $this->add_action_buttons(true, get_string('allow', 'core_role'));
    }
103841
@Deprecated
  @Nullable
  public V get() {
    V value = pop();
    if (value != null) {
      mInUseLength++;
    }
    return value;
  }