Get the signup required settings and profile fields.

@return array settings and possible warnings
@since Moodle 3.2
@throws moodle_exception
559880
public static function get_signup_settings() {
        global $CFG, $PAGE;

        $context = context_system::instance();
        // We need this to make work the format text functions.
        $PAGE->set_context($context);

        self::check_signup_enabled();

        $result = array();
        $result['namefields'] = useredit_get_required_name_fields();

        if (!empty($CFG->passwordpolicy)) {
            $result['passwordpolicy'] = print_password_policy();
        }
        $manager = new \core_privacy\local\sitepolicy\manager();
        if ($sitepolicy = $manager->get_embed_url()) {
            $result['sitepolicy'] = $sitepolicy->out(false);
        }
        if (!empty($CFG->sitepolicyhandler)) {
            $result['sitepolicyhandler'] = $CFG->sitepolicyhandler;
        }
        if (!empty($CFG->defaultcity)) {
            $result['defaultcity'] = $CFG->defaultcity;
        }
        if (!empty($CFG->country)) {
            $result['country'] = $CFG->country;
        }

        if ($fields = profile_get_signup_fields()) {
            $result['profilefields'] = array();
            foreach ($fields as $field) {
                $fielddata = $field->object->get_field_config_for_external();
                $fielddata['categoryname'] = external_format_string($field->categoryname, $context->id);
                $fielddata['name'] = external_format_string($fielddata['name'], $context->id);
                list($fielddata['defaultdata'], $fielddata['defaultdataformat']) =
                    external_format_text($fielddata['defaultdata'], $fielddata['defaultdataformat'], $context->id);

                $result['profilefields'][] = $fielddata;
            }
        }

        if (signup_captcha_enabled()) {
            // With reCAPTCHA v2 the captcha will be rendered by the mobile client using just the publickey.
            // For now include placeholders for the v1 paramaters to support older mobile app versions.
            $result['recaptchapublickey'] = $CFG->recaptchapublickey;
            list($result['recaptchachallengehash'], $result['recaptchachallengeimage'], $result['recaptchachallengejs']) =
                array('', '', '');
        }

        $result['warnings'] = array();
        return $result;
    }
291860
public function getSettings()
    {
        return json_encode([
            'connect_url'                   => $this->getConnectJsUrl(),
            'publishable_key_back_office'   => $this->getBackOfficeKey(),
            'create_order_url'              => $this->getUrl(Config::CREATE_ORDER_ACTION),
            'save_order_url'                => $this->getUrl(Config::SAVE_ORDER_ACTION),
        ]);
    }
90592
public function getPluginSettings()
    {
        $settingsList = Plugin::getPluginSettingsKeys();

        $formattedSettings = array();
        foreach ($settingsList as $setting) {
            $value = $this->dataStore->get($setting);
            if ($value === null) {
                //setting hasn't been set yet.
                $value = $this->api->createPluginSettingObject($setting, null, true, null);
            }
            array_push($formattedSettings, $value);
        }

        $response = $this->api->createAPISuccessResponse(
            $formattedSettings
        );

        return $response;
    }
181923
public function getConfig(): array
	{
		global $txt, $modSettings;

		$file = $this->_app->boardDir .'/_config'. $this->_app->name .'.json';

		// Already loaded or does not use config?
		if ($this->_config || !$this->_app->useConfig)
			return $this->_config;

		// Check for a $modSettings key first.
		if (!empty($modSettings['_config'. $this->_app->name]))
			return $this->_config = smf_json_decode($modSettings['_config'. $this->_app->name], true);

		// Get the json file. Must be located in $boarddir folder.
		if (!$this->_config && !file_exists($file))
		{
			loadLanguage('Errors');
			log_error(sprintf($txt['error_bad_file'], $file));
		}

		else
			$this->_config = smf_json_decode(file_get_contents($file), true);

		return $this->_config;
	}
907653
public function getTextSettings()
    {
        $fields = $this->agenda->getFieldLabels();
        $description = sprintf($this->_(
                "Use the %%-sign to search for zero or more random characters and an _ for a single random character."
                ));

        return array(
            'gaf_filter_text1' => array(
                'label'        => $this->_('Field 1'),
                'multiOptions' => $fields,
                'required'     => true,
                ),
            'gaf_filter_text2' => array(
                'label'        => $this->_('Search text 1'),
                'description'  => $description,
                'required'     => true,
                ),
            'gaf_filter_text3' => array(
                'label'        => $this->_('Field 2'),
                'multiOptions' => $this->util->getTranslated()->getEmptyDropdownArray() + $fields,
                ),
            'gaf_filter_text4' => array(
                'label'       => $this->_('Search text 2'),
                'description' => sprintf($this->_("Required when filled - use %%-sign as well.")),
                ),
            );
    }
1359321
protected function getAssignedCustomfields()
    {

        $customfields = array_get(app('customfields')->get(), get_called_class(), []);
        return !is_array($customfields) ? [$customfields] : $customfields;
    }
1336752
public function signupAction()
    {
        $form = new SignUpForm();

        if ($this->request->isPost()) {

            if ($form->isValid($this->request->getPost()) != false) {

                $user = new Users([
                    'name' => $this->request->getPost('name', 'striptags'),
                    'email' => $this->request->getPost('email'),
                    'password' => $this->security->hash($this->request->getPost('password')),
                    'profilesId' => 2
                ]);

                if ($user->save()) {
//                    return $this->dispatcher->forward([
//                        'namespace' => 'Modules\Frontend\Controllers',
//                        'controller' => 'index',
//                        'action' => 'index'
//                    ]);
                    return $this->response->redirect('index');
                }

                $this->flash->error($user->getMessages());
            }
        }

        $this->view->form = $form;
    }
133568
protected function getRulesConfig()
    {
        if (!$this->getFormParent()) {
            return null;
        }
        $formFields = $this->getFormParent()->Fields();

        $config = GridFieldConfig::create()
            ->addComponents(
                new GridFieldButtonRow('before'),
                new GridFieldToolbarHeader(),
                new GridFieldAddNewInlineButton(),
                new GridFieldDeleteAction(),
                $columns = new GridFieldEditableColumns()
            );

        $columns->setDisplayFields(array(
            'ConditionFieldID' => function ($record, $column, $grid) use ($formFields) {
                return DropdownField::create($column, false, $formFields->map('ID', 'Title'));
            },
            'ConditionOption' => function ($record, $column, $grid) {
                $options = EmailRecipientCondition::config()->condition_options;
                return DropdownField::create($column, false, $options);
            },
            'ConditionValue' => function ($record, $column, $grid) {
                return TextField::create($column);
            }
        ));

        return $config;
    }
363400
public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $PeopleConfig = GridFieldConfig_RecordEditor::create(100);
        if ($this->People()->Count() > 0) {
            $PeopleConfig->addComponent(new GridFieldOrderableRows());
        }

        $fields->addFieldsToTab(
            'Root.Main',
            array(
                TextareaField::create(
                    'Title'
                )->setRows(1),
                HTMLEditorField::create(
                    'Content'
                ),
                GridField::create(
                    'People',
                    'Current People(s)',
                    $this->People(),
                    $PeopleConfig
                )
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
1082041
public static function getSettings()
    {
        if (self::$settings === null) {
            $configuration = self::parseSettings();
            self::$settings = new EmConfiguration($configuration);
        }

        return self::$settings;
    }
81775
public function get_setting() {
        global $CFG;

        $config = $this->config_read($this->name);
        if (is_null($config)) {
            return null;
        }

        return $this->prepare_form_data($config);
    }
781104
protected function getAdvancedConfigLinkFields()
    {
        return array(
            'tellAboutAdvancedSettings' => array(
                'type' => 'markup',
                'value' => sprintf($this->t('desc_advancedSettings'), $this->t('advanced_form_link_text'), $this->t('menu_advancedSettings')),
            ),
            'advancedSettingsLink' => array(
                'type' => 'markup',
                'value' => sprintf($this->t('button_link'), $this->t('advanced_form_link_text'), $this->shopCapabilities->getLink('advanced')),
            ),
        );
    }
638489
public function getSettings()
    {
        $settings = Settings::all()->keyBy('settingsKey');

        $settings['defaultLanguage'] = (object) array('value' => Language::getDefault()->languageID);

        if(isset($settings['logo'])) {
            $media = Media::where('mediaID', $settings['logo']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($media) {
                $settings['logo']['media'] = $media;
            }
            $watermark = Media::where('mediaID', $settings['watermark']->value)->select("mediaID", "type", "filename", "fileDirectory")->first();
            if ($watermark) {
                $settings['watermark']['media'] = $watermark;
            }
        }
        // user groups
        $userGroups = UserGroup::all();
        // get all posts
        $posts = DB::table('post_pages')->select("postID", "title", "slug")->get();
        $posts = Language::filterRows($posts, false);
        // theme configs
        $themeConfigs = Theme::configs();

        return [
            'settings' => $settings,
            'userGroups' => $userGroups,
            'pages' => $posts,
            'themeConfigs' => $themeConfigs,
        ];
    }
832091
public function getFieldDefinitions()
    {
        $fields = array();

        $message = $this->checkAccountSettings();
        $accountOk = empty($message);

        // Message fieldset: if account settings have not been filled in.
        if (!$accountOk) {
            $fields['accountSettingsHeader'] = array(
              'type' => 'fieldset',
              'legend' => $this->t('message_error_header'),
              'fields' => array(
                'invoiceMessage' => array(
                  'type' => 'markup',
                  'value' => $message,
                ),
              ),
            );
        }

        // 1st fieldset: Link to config form.
        $fields['configHeader'] = array(
            'type' => 'details',
            'summary' => $this->t('config_form_header'),
            'fields' => $this->getConfigLinkFields(),
        );

        if ($accountOk) {
            $fields += array(
                'tokenHelpHeader' => array(
                    'type' => 'details',
                    'summary' => $this->t('tokenHelpHeader'),
                    'description' => $this->t('desc_tokens'),
                    'fields' => $this->getTokenFields(),
                ),
                'relationSettingsHeader' => array(
                    'type' => 'fieldset',
                    'legend' => $this->t('relationSettingsHeader'),
                    'description' => $this->t('desc_relationSettingsHeader'),
                    'fields' => $this->getRelationFields(),
                ),
                'invoiceSettingsHeader' => array(
                    'type' => 'fieldset',
                    'legend' => $this->t('invoiceSettingsHeader'),
                    'fields' => $this->getInvoiceFields(),
                ),
                'invoiceLinesSettingsHeader' => array(
                    'type' => 'fieldset',
                    'legend' => $this->t('invoiceLinesSettingsHeader'),
                    'fields' => $this->getInvoiceLinesFields(),
                ),
                'optionsSettingsHeader' => array(
                    'type' => 'fieldset',
                    'legend' => $this->t('optionsSettingsHeader'),
                    'description' => $this->t('desc_optionsSettingsHeader'),
                    'fields' => $this->getOptionsFields(),
                ),
                'emailAsPdfSettingsHeader' => array(
                    'type' => 'fieldset',
                    'legend' => $this->t('emailAsPdfSettingsHeader'),
                    'description' => $this->t('desc_emailAsPdfSettings'),
                    'fields' => $this->getEmailAsPdfFields(),
                ),
            );
        }

        $fields += array(
            'versionInformationHeader' => array(
                'type' => 'fieldset',
                'legend' => $this->t('versionInformationHeader'),
                'fields' => $this->getVersionInformation(),
            ),
        );

        return $fields;
    }
84790
private function getSettings()
    {
        $rootPath = $this->complement['path']['root'];
        $configFile = $rootPath . 'config/';

        if (is_dir($configFile) && $handle = scandir($configFile)) {
            $files = array_slice($handle, 2);

            foreach ($files as $file) {
                $content = require $configFile . $file;
                $merge = array_merge($this->complement, $content);
                $this->complement = $merge;
            }
        }

        $this->complement['path']['root'] = $rootPath;
        $this->complement['path']['config'] = $configFile;
    }
195881
public function Fields()
    {
        $list     = $this->getComponents('Fields');
        $fields   = singleton(Member::class)->getMemberFormFields()->dataFields();
        $included = array();

        foreach ($list as $profileField) {
            if (!array_key_exists($profileField->MemberField, $fields)) {
                $profileField->delete();
            } else {
                $included[] = $profileField->MemberField;
            }
        }

        foreach ($fields as $name => $field) {
            if (!in_array($name, $included)) {
                $profileField = new MemberProfileField();
                $profileField->MemberField = $name;

                if (isset(self::$profile_field_defaults[$name])) {
                    $profileField->update(self::$profile_field_defaults[$name]);
                }

                $list->add($profileField);
            }
        }

        return $list;
    }
795784
public function getFormFields()
    {
        if (!$theme = CmsTheme::load($this->theme)) {
            throw new Exception(Lang::get('Unable to find theme with name :name', $this->theme));
        }

        $config = $theme->getFormConfig();

        return array_get($config, 'fields', []) +
            array_get($config, 'tabs.fields', []) +
            array_get($config, 'secondaryTabs.fields', []);
    }