Definitions of the additional options that site uses

@param bool $foreditform
@return array of options
435357
public function course_format_options($foreditform = false) {
        static $courseformatoptions = false;
        if ($courseformatoptions === false) {
            $courseformatoptions = array(
                'numsections' => array(
                    'default' => 1,
                    'type' => PARAM_INT,
                ),
            );
        }
        return $courseformatoptions;
    }
908121
public function getOptions($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');

        $options = $this->options;

        if ($includeBase && $this->baseFormat) {
            // append base options
            $options = array_replace($options, $this->baseFormat->getOptions());
        }

        return $options;
    }
231623
public function setForm($form)
    {
        foreach ($this->namedLinkCompositeField->compositeDatabaseFields() as $field => $spec) {
            $fieldHandle = 'field' . $field;
            $this->{$fieldHandle}->setForm($form);
        }
//		$this->fieldPageID->setForm($form);
//		$this->fieldPageAnchor->setForm($form);
//		$this->fieldFileID->setForm($form);
//		$this->fieldCustomURL->setForm($form);
//		$this->fieldShortcode->setForm($form);
//		$this->fieldTitle->setForm($form);
//		$this->fieldLinkmode->setForm($form);

		parent::setForm($form);

        return $this;
	}
1260146
public function get_options(&$mform) {
        global $DB;
        $none = false;
        $availablebadges = null;

        $mform->addElement('header', 'first_header', $this->get_title());
        $mform->addHelpButton('first_header', 'criteria_' . $this->criteriatype, 'badges');

        // Determine if this badge is a course badge or a site badge.
        $competencies = '';
        if (count($this->params)) {
            $competencies = implode(',', array_keys($this->params));
        }
        $badge = $DB->get_record('badge', array('id' => $this->badgeid));
        $context = null;
        $courseid = 0;

        if ($badge->type == BADGE_TYPE_SITE) {
            $context = context_system::instance();
            $courseid = SITEID;
        } else if ($badge->type == BADGE_TYPE_COURSE) {
            $context = context_course::instance($badge->courseid);
            $courseid = $badge->courseid;
        }
        if ($pluginsfunction = get_plugins_with_function('competency_picker')) {
            foreach ($pluginsfunction as $plugintype => $plugins) {
                foreach ($plugins as $pluginfunction) {
                    $output[] = $pluginfunction($mform, $courseid, $context, 'competency_competencies');
                }
            }
        }
        $mform->getElement('competency_competencies')->setValue($competencies);
        $mform->addRule('competency_competencies', get_string('requiredcompetency', 'badges'), 'required');

        // Add aggregation.
        if (!$none) {
            $mform->addElement('header', 'aggregation', get_string('method', 'badges'));
            $agg = array();
            $agg[] =& $mform->createElement('radio', 'agg', '', get_string('allmethodcompetencies', 'badges'), 1);
            $agg[] =& $mform->createElement('radio', 'agg', '', get_string('anymethodcompetencies', 'badges'), 2);
            $mform->addGroup($agg, 'methodgr', '', array('<br/>'), false);
            if ($this->id !== 0) {
                $mform->setDefault('agg', $this->method);
            } else {
                $mform->setDefault('agg', BADGE_CRITERIA_AGGREGATION_ANY);
            }
        }

        return array($none, get_string('noparamstoadd', 'badges'));
    }
1350083
public function CommentsForm()
    {
        $form = Injector::inst()->create(CommentForm::class, __FUNCTION__, $this);

        // hook to allow further extensions to alter the comments form
        $this->extend('alterCommentForm', $form);

        return $form;
    }
658768
public function getDefaultOptions(): array
    {
        $options = parent::getDefaultOptions();

        // Check the "type" attribute. If it is not set,
        // let's define it by default to "submit".
        if (! isset($options['attributes']['type'])) {
            $options['attributes']['type'] = 'submit';
        }

        // By default, disable button field type to be mapped
        // to a data object.
        $options['mapped'] = false;

        return $options;
    }
32338
public static function form_policydoc_add(stdClass $form) {
        global $DB;

        $form = clone($form);

        $form->policyid = $DB->insert_record('tool_policy', (object) [
            'sortorder' => 999,
        ]);

        static::distribute_policy_document_sortorder();

        return static::form_policydoc_update_new($form);
    }
807015
private function getFormOptionsDeclaration()
    {

        // we got a max instances allowed in normality tags
        $formOptions = json_encode( $this->formOptions );
        $formOptions = Php::varExport( $formOptions, true );

        $this->class->classComponents[] = new VariableDeclaration(
            'formOptions',
            new SFormatf( <<<'PHP'
                /**
                 * Form options from relation
                 * @var array
                 */
                protected $formOptions = %s;
PHP
                , $formOptions
            )
        );

    }
652287
protected function buildForm(FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Create a new site');

        $introduction = $page1->createElement('introduction', 'Neos.Form:StaticText');
        $introduction->setProperty('text', 'There are two ways of creating a site. Choose between the following:');

        $importSection = $page1->createElement('import', 'Neos.Form:Section');
        /** @var Section $importSection */
        $importSection->setLabel('Import a site from an existing site package');

        $sitePackages = [];
        foreach ($this->packageManager->getFilteredPackages('available', null, 'neos-site') as $package) {
            /** @var PackageInterface $package */
            $sitePackages[$package->getPackageKey()] = $package->getPackageKey();
        }

        if (count($sitePackages) > 0) {
            $site = $importSection->createElement('site', 'Neos.Form:SingleSelectDropdown');
            $site->setLabel('Select a site package');
            $site->setProperty('options', $sitePackages);
            $site->addValidator(new NotEmptyValidator());

            $sites = $this->siteRepository->findAll();
            if ($sites->count() > 0) {
                $prune = $importSection->createElement('prune', 'Neos.Form:Checkbox');
                $prune->setLabel('Delete existing sites');
            }
        } else {
            $error = $importSection->createElement('noSitePackagesError', 'Neos.Form:StaticText');
            $error->setProperty('text', 'No site packages were available, make sure you have an active site package');
            $error->setProperty('elementClassAttribute', 'alert alert-warning');
        }

        if ($this->packageManager->isPackageAvailable('Neos.SiteKickstarter')) {
            $separator = $page1->createElement('separator', 'Neos.Form:StaticText');
            $separator->setProperty('elementClassAttribute', 'section-separator');

            $newPackageSection = $page1->createElement('newPackageSection', 'Neos.Form:Section');
            /** @var Section $newPackageSection */
            $newPackageSection->setLabel('Create a new site package with a dummy site');
            $packageName = $newPackageSection->createElement('packageKey', 'Neos.Form:SingleLineText');
            $packageName->setLabel('Package Name (in form "Vendor.DomainCom")');
            $packageName->addValidator(new PackageKeyValidator());

            $siteName = $newPackageSection->createElement('siteName', 'Neos.Form:SingleLineText');
            $siteName->setLabel('Site Name (e.g. "domain.com")');
        } else {
            $error = $importSection->createElement('neosKickstarterUnavailableError', 'Neos.Form:StaticText');
            $error->setProperty('text', 'The Neos Kickstarter package (Neos.SiteKickstarter) is not installed, install it for kickstarting new sites (using "composer require typo3/neos-kickstarter")');
            $error->setProperty('elementClassAttribute', 'alert alert-warning');
        }

        $sitePackageExplanation = $page1->createElement('sitePackageExplanation', 'Neos.Form:StaticText');
        $sitePackageExplanation->setProperty('text', 'Notice the difference between a site package and a site. A site package is a Flow package that can be used for creating multiple site instances.');
        $sitePackageExplanation->setProperty('elementClassAttribute', 'alert alert-info');

        if (count($sitePackages) > 0) {
            $sitePackageAlreadyAvailableExplanation = $page1->createElement('sitePackageAlreadyAvailableExplanation', 'Neos.Form:StaticText');
            $sitePackageAlreadyAvailableExplanation->setProperty('text', sprintf('There are already other site packages available (%s). Some configuration like dimensions and node type configurations are shared between all sites packages. Make sure you remove the site packages you don\'t want to interfere with your newly created package.', implode(array_keys($sitePackages))));
            $sitePackageAlreadyAvailableExplanation->setProperty('elementClassAttribute', 'alert alert-info');
        }

        $step = $this;
        $callback = function (FinisherContext $finisherContext) use ($step) {
            $step->importSite($finisherContext);
        };
        $this->closureFinisher = new ClosureFinisher();
        $this->closureFinisher->setOption('closure', $callback);
        $formDefinition->addFinisher($this->closureFinisher);

        $formDefinition->setRenderingOption('skipStepNotice', 'You can always import a site using the site:import command');
    }
394556
public function getFieldOptions()
    {
        $options = $this->formField->options();

        if (!$options && $this->mode === static::MODE_RELATION) {
            $options = $this->getRelationModel()->lists($this->nameFrom);
        }

        return $options;
    }
263602
public function get_options(&$mform) {
        global $PAGE;
        $options = '';
        $none = true;

        $roles = get_roles_with_capability('moodle/badges:awardbadge', CAP_ALLOW, $PAGE->context);
        $visibleroles = get_viewable_roles($PAGE->context);
        $roleids = array_map(function($o) {
            return $o->id;
        }, $roles);
        $existing = array();
        $missing = array();

        if ($this->id !== 0) {
            $existing = array_keys($this->params);
            $missing = array_diff($existing, $roleids);
        }

        if (!empty($missing)) {
            $mform->addElement('header', 'category_errors', get_string('criterror', 'badges'));
            $mform->addHelpButton('category_errors', 'criterror', 'badges');
            foreach ($missing as $m) {
                $this->config_options($mform, array('id' => $m, 'checked' => true, 'name' => get_string('error:nosuchrole', 'badges'), 'error' => true));
                $none = false;
            }
        }

        if (!empty($roleids)) {
            $mform->addElement('header', 'first_header', $this->get_title());
            $mform->addHelpButton('first_header', 'criteria_' . $this->criteriatype, 'badges');
            foreach ($roleids as $rid) {
                if (!key_exists($rid, $visibleroles)) {
                    continue;
                }
                $checked = false;
                if (in_array($rid, $existing)) {
                    $checked = true;
                }
                $this->config_options($mform, array('id' => $rid, 'checked' => $checked, 'name' => self::get_role_name($rid), 'error' => false));
                $none = false;
            }
        }

        // Add aggregation.
        if (!$none) {
            $mform->addElement('header', 'aggregation', get_string('method', 'badges'));
            $agg = array();
            $agg[] =& $mform->createElement('radio', 'agg', '', get_string('allmethodmanual', 'badges'), 1);
            $agg[] =& $mform->createElement('static', 'none_break', null, '<br/>');
            $agg[] =& $mform->createElement('radio', 'agg', '', get_string('anymethodmanual', 'badges'), 2);
            $mform->addGroup($agg, 'methodgr', '', array(' '), false);
            if ($this->id !== 0) {
                $mform->setDefault('agg', $this->method);
            } else {
                $mform->setDefault('agg', BADGE_CRITERIA_AGGREGATION_ANY);
            }
        }

        return array($none, get_string('noparamstoadd', 'badges'));
    }
285687
public function course_format_options($foreditform = false) {
        static $courseformatoptions = false;
        if ($courseformatoptions === false) {
            $courseconfig = get_config('moodlecourse');
            $courseformatoptions = array(
                'hiddensections' => array(
                    'default' => $courseconfig->hiddensections,
                    'type' => PARAM_INT,
                ),
                'coursedisplay' => array(
                    'default' => $courseconfig->coursedisplay,
                    'type' => PARAM_INT,
                ),
                'automaticenddate' => array(
                    'default' => 1,
                    'type' => PARAM_BOOL,
                ),
            );
        }
        if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) {
            $courseformatoptionsedit = array(
                'hiddensections' => array(
                    'label' => new lang_string('hiddensections'),
                    'help' => 'hiddensections',
                    'help_component' => 'moodle',
                    'element_type' => 'select',
                    'element_attributes' => array(
                        array(
                            0 => new lang_string('hiddensectionscollapsed'),
                            1 => new lang_string('hiddensectionsinvisible')
                        )
                    ),
                ),
                'coursedisplay' => array(
                    'label' => new lang_string('coursedisplay'),
                    'element_type' => 'select',
                    'element_attributes' => array(
                        array(
                            COURSE_DISPLAY_SINGLEPAGE => new lang_string('coursedisplay_single'),
                            COURSE_DISPLAY_MULTIPAGE => new lang_string('coursedisplay_multi')
                        )
                    ),
                    'help' => 'coursedisplay',
                    'help_component' => 'moodle',
                ),
                'automaticenddate' => array(
                    'label' => new lang_string('automaticenddate', 'format_weeks'),
                    'help' => 'automaticenddate',
                    'help_component' => 'format_weeks',
                    'element_type' => 'advcheckbox',
                )
            );
            $courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit);
        }
        return $courseformatoptions;
    }
197141
protected function _getFormSubmitExtraLeftButtons()
    {
        $action = $this->_action();
        $buttons = $action->getConfig('scaffold.form_submit_extra_left_buttons');

        if ($buttons === false) {
            return [];
        }

        if ($buttons === null || $buttons === true) {
            $buttons = $this->_getDefaultExtraLeftButtons();
        }

        return $buttons;
    }
1374810
protected function addAnswersFields(FormInterface $form)
    {
        $question = $this->questionInteract->getQuestion();
        $data = $this->getQuestionData();

        /** @var AnswerCheckerInterface $checker */
        $checker = $this->checkerLocator->get($question->getType());
        $options = $checker->getOptions($question->getAnswers()->getValues(), $data);
        $form->add('answers', $checker->getType(), $options);
    }
722629
protected function prepare_fields( Form $form ) {
		foreach ( $form->all() as $field ) {
			/* @var $field \WPLibs\Form\Field */
			if ( ! $field->should_show() ) {
				return;
			}

			$_section = $field->get_option( 'section' );

			if ( ! $_section || ! isset( $this->sections[ $_section ] ) ) {
				continue;
			}

			$this->sections[ $_section ]->fields[] = $field;
		}
	}
425087
public function filterSucceeded(Form $form)
	{
		if ($this->snippets_set) {
			return;
		}

		$values = $form->getValues();

		if ($this->getPresenter()->isAjax()) {
			if (isset($form['group_action']['submit']) && $form['group_action']['submit']->isSubmittedBy()) {
				return;
			}
		}

		/**
		 * Per page
		 */
		$this->saveSessionData('_grid_per_page', $values->per_page);
		$this->per_page = $values->per_page;

		/**
		 * Inline edit
		 */
		if (isset($form['inline_edit']) && isset($form['inline_edit']['submit']) && isset($form['inline_edit']['cancel'])) {
			$edit = $form['inline_edit'];

			if ($edit['submit']->isSubmittedBy() || $edit['cancel']->isSubmittedBy()) {
				$id = $form->getHttpData(Form::DATA_LINE, 'inline_edit[_id]');
				$primary_where_column = $form->getHttpData(
					Form::DATA_LINE,
					'inline_edit[_primary_where_column]'
				);

				if ($edit['submit']->isSubmittedBy() && !$edit->getErrors()) {
					$this->inlineEdit->onSubmit($id, $values->inline_edit);
					$this->getPresenter()->payload->_datagrid_inline_edited = $id;
					$this->getPresenter()->payload->_datagrid_name = $this->getName();
				} else {
					$this->getPresenter()->payload->_datagrid_inline_edit_cancel = $id;
					$this->getPresenter()->payload->_datagrid_name = $this->getName();
				}

				if ($edit['submit']->isSubmittedBy() && !empty($this->inlineEdit->onCustomRedraw)) {
					$this->inlineEdit->onCustomRedraw();
				} else {
					$this->redrawItem($id, $primary_where_column);
					$this->redrawControl('summary');
				}

				return;
			}
		}

		/**
		 * Inline add
		 */
		if (isset($form['inline_add']) && isset($form['inline_add']['submit']) && isset($form['inline_add']['cancel'])) {
			$add = $form['inline_add'];

			if ($add['submit']->isSubmittedBy() || $add['cancel']->isSubmittedBy()) {
				if ($add['submit']->isSubmittedBy() && !$add->getErrors()) {
					$this->inlineAdd->onSubmit($values->inline_add);

					if ($this->getPresenter()->isAjax()) {
						$this->getPresenter()->payload->_datagrid_inline_added = true;
					}
				}

				return;
			}
		}

		/**
		 * Filter itself
		 */
		$values = $values['filter'];

		foreach ($values as $key => $value) {
			/**
			 * Session stuff
			 */
			if ($this->remember_state && $this->getSessionData($key) != $value) {
				/**
				 * Has been filter changed?
				 */
				$this->page = 1;
				$this->saveSessionData('_grid_page', 1);
			}

			$this->saveSessionData($key, $value);

			/**
			 * Other stuff
			 */
			$this->filter[$key] = $value;
		}

		if (!empty($values)) {
			$this->saveSessionData('_grid_has_filtered', 1);
		}

		if ($this->getPresenter()->isAjax()) {
			$this->getPresenter()->payload->_datagrid_sort = [];

			foreach ($this->columns as $key => $column) {
				if ($column->isSortable()) {
					$this->getPresenter()->payload->_datagrid_sort[$key] = $this->link('sort!', [
						'sort' => $column->getSortNext(),
					]);
				}
			}
		}

		$this->reload();
	}
967307
public function getFormFieldValueOptions(FieldInterface $field)
    {
        $formFieldOptions = [];
        $formFieldOptions['choices'] = array_flip($this->getFieldOptionsArray($field));
        $formFieldOptions['expanded'] = $this->isExpanded;
        $formFieldOptions['multiple'] = $this->getIsMultipleChoice($field);

        return $formFieldOptions;
    }