本文整理汇总了PHP中Drupal\Core\Form\ConfigFormBase类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFormBase类的具体用法?PHP ConfigFormBase怎么用?PHP ConfigFormBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigFormBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->configFactory->getEditable('commerce_cart.settings');
$config->set('cart_page.view', $form_state->getValue('view'));
$config->save();
parent::submitForm($form, $form_state);
}
开发者ID:housineali,项目名称:drpl8_dv,代码行数:10,代码来源:CartSettingsForm.php
示例2: submitForm
public function submitForm(array &$form, FormStateInterface $form_state)
{
parent::submitForm($form, $form_state);
$config = $this->config('hugs.settings');
$config->set('default_count', $form_state->getValue('default_count'));
$config->save();
}
开发者ID:sriharisahu,项目名称:hugs,代码行数:7,代码来源:ConfigForm.php
示例3: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$config = $this->config('configform_example.settings');
$config->set('email_address', $form_state->getValue('email'));
$config->save();
return parent::submitForm($form, $form_state);
}
开发者ID:selwynpolit,项目名称:d8_test2,代码行数:10,代码来源:ConfigFormExampleConfigForm.php
示例4: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
parent::submitForm($form, $form_state);
// $config = $this->config('idmygadget.settings');
// $config->set('idmygadget_', $form_state->getValue('idmygadget_'));
// $config->save();
}
开发者ID:tomwhartung,项目名称:jmws_idMyGadget_for_drupal-d8,代码行数:10,代码来源:ConfigFormIdMyGadgetBase.php
示例5: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
parent::submitForm($form, $form_state);
// normalize line endings to \n
$selectors = preg_replace('/[\\r\\n]+/', "\n", $form_state->getValue('exclude_hover_selectors'));
$this->config('pinterest_hover.settings')->set('load_pinterest_js', $form_state->getValue('load_pinterest_js'))->set('exclude_hover_selectors', $selectors)->save();
}
开发者ID:mbaynton,项目名称:pinterest_responsive,代码行数:10,代码来源:ConfigForm.php
示例6: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('dropdown_language.setting')
->set('wrapper', $form_state->getValue('wrapper'))
->save();
parent::submitForm($form, $form_state);
Cache::invalidateTags(['rendered']);
}
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:10,代码来源:DropdownLanguageSettings.php
示例7: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
// Remove unnecessary values.
form_state_values_clean($form_state);
$this->config('faq.settings')->set('use_categories', $form_state['values']['faq_use_categories'])->set('category_display', $form_state['values']['faq_category_display'])->set('category_listing', $form_state['values']['faq_category_listing'])->set('category_hide_qa_accordion', $form_state['values']['faq_category_hide_qa_accordion'])->set('count', $form_state['values']['faq_count'])->set('answer_category_name', $form_state['values']['faq_answer_category_name'])->set('group_questions_top', $form_state['values']['faq_group_questions_top'])->set('hide_child_terms', $form_state['values']['faq_hide_child_terms'])->set('show_term_page_children', $form_state['values']['faq_show_term_page_children'])->set('omit_vocabulary', $form_state['values']['faq_omit_vocabulary'])->save();
parent::submitForm($form, $form_state);
}
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:10,代码来源:CategoriesForm.php
示例8: buildForm
public function buildForm(array $form, FormStateInterface $form_state)
{
$cors_domains = '';
$config_cors = $this->configFactory->get('cors.config')->get('cors_domains');
if (!empty($config_cors)) {
foreach ($config_cors as $path => $domain) {
$cors_domains .= $path . '|' . $domain . "\n";
}
}
$form = array();
$form['cors_domains'] = array('#type' => 'textarea', '#title' => t('Domains'), '#description' => t('A list of paths and corresponding domains to enable for CORS. Multiple entries should be separated by a comma. Enter one value per line separated by a pipe, in this order:
<ul>
<li>Internal path</li>
<li>Access-Control-Allow-Origin. Use <mirror> to echo back the Origin header.</li>
<li>Access-Control-Allow-Methods</li>
<li>Access-Control-Allow-Headers</li>
<li>Access-Control-Allow-Credentials</li>
</ul>
Examples:
<ul>
<li>*|http://example.com</li>
<li>api|http://example.com:8080 http://example.com</li>
<li>api/*|<mirror>,https://example.com</li>
<li>api/*|<mirror>|POST|Content-Type,Authorization|true</li>
</ul>'), '#default_value' => $cors_domains, '#rows' => 10);
return parent::buildForm($form, $form_state);
}
开发者ID:nuxy,项目名称:cors,代码行数:27,代码来源:CorsConfigForm.php
示例9: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$bdd_ivw_settings = $this->config('bdd_ivw.settings');
$form['current_code'] = array('#markup' => 'Current Default Code: ' . $this->token->replace($bdd_ivw_settings->get('code_template'), array(), array('sanitize' => FALSE)));
$form['settings'] = array('#type' => 'vertical_tabs', '#default_tab' => 'site_settings');
$form['site_settings'] = array('#type' => 'details', '#title' => t('Site settings'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#group' => 'ivw_settings');
$form['default_values'] = array('#type' => 'details', '#title' => t('Default values'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'ivw_settings');
$form['site_settings']['site'] = array('#type' => 'textfield', '#title' => t('IVW Site name'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('site'), '#description' => t('Site name as given by IVW, this is used as default for the "st" parameter in the iam_data object'));
$form['site_settings']['code_template'] = array('#type' => 'textfield', '#title' => t('Code template'), '#required' => TRUE, '#maxlength' => 256, '#size' => 128, '#default_value' => $bdd_ivw_settings->get('code_template'), '#description' => t('Code template, for creating the actual ivw code.'));
$form['site_settings']['code_template_token_tree'] = array('#theme' => 'token_tree', '#token_types' => ['ivw']);
$form['site_settings']['responsive'] = array('#type' => 'checkbox', '#title' => t('Site is responsive'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('responsive'), '#description' => t('Responsive sites must handle mobile code in javascript, this is activated here.'));
$form['site_settings']['mobile_width'] = array('#type' => 'textfield', '#states' => array('invisible' => array(':input[name="ivw_responsive"]' => array('checked' => FALSE))), '#title' => t('Mobile width'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('mobile_width'), '#description' => t('On a responsive site, this value tells the javascript up to which screen width, the device should be treated as mobile.'));
$form['default_values']['offering_default'] = array('#type' => 'textfield', '#title' => t('Fallback offering code'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('offering_default'), '#description' => t('A single ivw site can have multiple offerings, they can be differentiated by different numbers.'), '#min' => 1);
$form['default_values']['offering_overridable'] = array('#type' => 'checkbox', '#title' => t('Offering code is overrideable'), '#default_value' => $bdd_ivw_settings->get('offering_overridable'));
$form['default_values']['language_default'] = array('#type' => 'select', '#options' => array(1 => 'Deutsch', 2 => 'Andere Sprache, Inhalt prüfbar', 3 => 'Andere Sprache, Inhalt nicht prüfbar'), '#title' => t('Fallback language'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('language_default'));
$form['default_values']['language_overridable'] = array('#type' => 'checkbox', '#title' => t('Language code is overrideable'), '#default_value' => $bdd_ivw_settings->get('language_overridable'));
$form['default_values']['format_default'] = array('#type' => 'select', '#options' => array(1 => 'Bild/Text', 2 => 'Audio', 3 => 'Video', 4 => 'Andere dynamische Formate'), '#title' => t('Fallback format'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('format_default'));
$form['default_values']['format_overridable'] = array('#type' => 'checkbox', '#title' => t('Format code is overrideable'), '#default_value' => $bdd_ivw_settings->get('format_overridable'));
$form['default_values']['creator_default'] = array('#type' => 'select', '#options' => array(1 => 'Redaktion', 2 => 'User', 3 => 'Unbekannt'), '#title' => t('Fallback creator'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('creator_default'));
$form['default_values']['creator_overridable'] = array('#type' => 'checkbox', '#title' => t('Creator code is overrideable'), '#default_value' => $bdd_ivw_settings->get('creator_overridable'));
$form['default_values']['homepage_default'] = array('#type' => 'select', '#options' => array(1 => 'Homepage des Angebots', 2 => 'Keine Homepage', 3 => 'Hompage der Fremddomains bei Multi-Angeboten'), '#title' => t('Fallback homepage flag'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('homepage_default'));
$form['default_values']['homepage_overridable'] = array('#type' => 'checkbox', '#title' => t('Homepage flag is overridable'), '#default_value' => $bdd_ivw_settings->get('homepage_overridable'));
$form['default_values']['delivery_default'] = array('#type' => 'select', '#options' => array(1 => 'Online', 2 => 'Mobile', 3 => 'Connected TV'), '#title' => t('Fallback delivery'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('delivery_default'));
$form['default_values']['delivery_overridable'] = array('#type' => 'checkbox', '#title' => t('Delivery flag is overridable'), '#default_value' => $bdd_ivw_settings->get('delivery_overridable'));
$form['default_values']['app_default'] = array('#type' => 'select', '#options' => array(1 => 'App', 2 => 'Keine App'), '#title' => t('Fallback app flag'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('app_default'));
$form['default_values']['app_overridable'] = array('#type' => 'checkbox', '#title' => t('App flag is overridable'), '#default_value' => $bdd_ivw_settings->get('app_overridable'));
$form['default_values']['paid_default'] = array('#type' => 'select', '#options' => array(1 => 'Paid', 2 => 'Nicht zugeordnet'), '#title' => t('Fallback paid flag'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('paid_default'));
$form['default_values']['paid_overridable'] = array('#type' => 'checkbox', '#title' => t('Paid flag is overridable'), '#default_value' => $bdd_ivw_settings->get('paid_overridable'));
$form['default_values']['content_default'] = array('#type' => 'select', '#options' => array('01' => 'Nachrichten', '02' => 'Sport', '03' => 'Entertainment/Boulevard/Stars/Film/Musik', '04' => 'Fashion/Beauty', '05' => 'Familie/Kinder/Lebenshilfe', '06' => 'Liebe/Psychologie/Beziehungen', '07' => 'Fahrzeuge/Verkehr/Mobilität', '08' => 'Reise/Touristik', '09' => 'Computer', '10' => 'Consumer Electronics', '11' => 'Telekommunikation/Internetdienste', '12' => 'Spiele', '13' => 'Wohnen/Immobilien/Garten/Haushalt', '14' => 'Wirtschaft/Finanzen/Job/Karriere', '15' => 'Gesundheit', '16' => 'Essen/Trinken', '17' => 'Kunst/Kultur/Literatur', '18' => 'Erotik', '19' => 'Wissenschaft/Bildung/Natur/Umwelt', '20' => 'Angebotsinformation', '21' => 'Vermischtes (multithematisch)', '22' => 'Sonstiges (monothematisch)', '23' => 'Übersichtsseite zu Spiele', '24' => 'Casual Games', '25' => 'Core Games', '26' => 'Sonstiges (Bereich Spiele)', '27' => 'Social Networking - Privat', '28' => 'Social Networking - Business', '29' => 'Partnersuche/Dating', '30' => 'Newsletter', '31' => 'E-Mail/SMS/E-Cards', '32' => 'Messenger/Chat', '33' => 'Sonstiges (Bereich Networking/Kommunikation', '34' => 'Suchmaschinen', '35' => 'Verzeichnisse/Auskunftsdienste', '36' => 'Sonstiges (Bereich Suchmaschinen/Verzeichnisse)', '37' => 'Onlineshops/Shopping Mall/Auktionen/B2bMarktplätze', '38' => 'Immobilien Rubrikenmärkte/Kleinanzeigen', '39' => 'Jobs Rubrikenmärkte/Kleinanzeigen', '40' => 'Fahrzeuge Rubrikenmärkte/Kleinanzeigen', '41' => 'Sonstiges Rubrikenmärkte/Kleinanzeigen', '42' => 'Sonstiges (Bereich E-Commerce)'), '#title' => t('Fallback content category'), '#required' => TRUE, '#default_value' => $bdd_ivw_settings->get('content_default'));
$form['default_values']['content_overridable'] = array('#type' => 'checkbox', '#title' => t('Content category is overridable'), '#default_value' => $bdd_ivw_settings->get('content_overridable'));
return parent::buildForm($form, $form_state);
}
开发者ID:Cyberschorsch,项目名称:module-ivw_integration,代码行数:35,代码来源:SettingsForm.php
示例10: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
module_load_include('inc', 'sociallogin');
$data = get_authentication($form_state->getValue('api_key'), $form_state->getValue('api_secret'));
if (isset($data['status']) && $data['status'] != 'status') {
drupal_set_message($data['message'], $data['status']);
return FALSE;
}
parent::SubmitForm($form, $form_state);
$this->config('sociallogin.settings')->set('sso_site_name', $form_state->getValue('sso_site_name'))->set('api_key', $form_state->getValue('api_key'))->set('api_secret', $form_state->getValue('api_secret'))->set('username_option', $form_state->getValue('username_option'))->set('login_redirection', $form_state->getValue('login_redirection'))->set('register_redirection', $form_state->getValue('register_redirection'))->set('custom_login_url', $form_state->getValue('custom_login_url'))->set('custom_register_url', $form_state->getValue('custom_register_url'))->set('enable_linking', $form_state->getValue('enable_linking'))->set('linking_text', $form_state->getValue('linking_text'))->save();
if (count(\Drupal::moduleHandler()->getImplementations('add_extra_sociallogin_config_settings')) > 0) {
// Call all modules that implement the hook, and let them make changes to $variables.
$config_data = \Drupal::moduleHandler()->invokeAll('add_extra_sociallogin_config_settings');
}
if (isset($config_data) && is_array($config_data)) {
foreach ($config_data as $key => $value) {
$this->config('sociallogin.settings')->set($value, $form_state->getValue($value))->save();
}
}
drupal_set_message(t('Social Login settings have been saved.'), 'status');
//Clear page cache
foreach (Cache::getBins() as $service_id => $cache_backend) {
if ($service_id == 'dynamic_page_cache') {
$cache_backend->deleteAll();
}
}
}
开发者ID:LoginRadius,项目名称:drupal-identity-module,代码行数:30,代码来源:SocialLoginSettingsForm.php
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$form = parent::buildForm($form, $form_state);
$account = $this->currentUser();
if (!$account->hasPermission('administer icepay config')) {
$form['notice'] = array('#markup' => '<div>' . $this->t('You must have access to <b>administer icepay config</b> to adjust these settings.') . '</div>');
return $form;
}
$ice_config = $this->config('uc_icepay.settings');
$form['icepay_merchant'] = array('#type' => 'details', '#title' => $this->t('Merchant details'), '#description' => $this->t('Please insert merchant details you have received from IcePay.'), '#open' => false, '#weight' => 1, '#attached' => array('library' => array('uc_icepay/uc_icepay.hideshow', 'uc_icepay/uc_icepay.admin-merchant')));
$form['icepay_merchant']['uc_icepay_merchant_id'] = array('#type' => 'textfield', '#title' => $this->t('Merchant ID'), '#default_value' => $ice_config->get('merchant_id'));
$form['icepay_merchant']['uc_icepay_secret_code'] = array('#type' => 'textfield', '#title' => $this->t('Secret code'), '#default_value' => $ice_config->get('secret_code'), '#suffix' => '<p><a href="#" id="icepay-merchant-showhide-secret">show pass</a></p>');
$form['icepay_general'] = array('#type' => 'details', '#title' => $this->t('General settings'), '#description' => $this->t('Needed for Icepay API can be used properly.'), '#weight' => 3, '#open' => false);
$icepay_statics = new IcepayStatics();
$form['icepay_general']['uc_icepay_country'] = array('#type' => 'select', '#title' => $this->t('Country'), '#options' => $icepay_statics->getCountriesOption(), '#default_value' => $ice_config->get('country'));
$form['icepay_general']['uc_icepay_language'] = array('#type' => 'select', '#title' => $this->t('Language'), '#options' => $icepay_statics->getLanguagesOption(), '#default_value' => $ice_config->get('language'));
$form['icepay_general']['uc_icepay_currency'] = array('#type' => 'select', '#title' => $this->t('Currency'), '#options' => $icepay_statics->getCurrenciesOption(), '#default_value' => $ice_config->get('currency'));
$form['icepay_general']['uc_icepay_mailing'] = array('#default_value' => $ice_config->get('mailing'));
$form['icepay_general']['uc_icepay_stream_method'] = array('#type' => 'select', '#title' => $this->t('API connect method'), '#options' => array('CURL' => $this->t('CURL (recommended)'), 'FOPEN' => $this->t('FOPEN (requires allow_url_fopen)')), '#default_value' => $ice_config->get('stream_method'));
$form['icepay_general']['uc_icepay_ipcheck'] = array('#type' => 'checkbox', '#title' => $this->t('IP check on postback'), '#default_value' => $ice_config->get('ipcheck'));
$form['icepay_general']['uc_icepay_https_protocol'] = array('#type' => 'checkbox', '#title' => $this->t('Use API HTTPS protocol'), '#default_value' => $ice_config->get('https_protocol'));
$form['icepay_url'] = array('#type' => 'details', '#title' => $this->t('ICEPAY merchant URL'), '#description' => $this->t('You can set another URL to handle success or error returned from Icepay provider.'), '#weight' => 5, '#open' => false);
global $base_url;
$form['icepay_url']['uc_icepay_url_ok'] = array('#type' => 'textfield', '#title' => $this->t('OK / success URL'), '#default_value' => $ice_config->get('url.ok'), '#description' => $this->t('When changed, do not forget to change it on your ICEPAY merchant account.'), '#field_prefix' => $base_url . '/');
$form['icepay_url']['uc_icepay_url_err'] = array('#type' => 'textfield', '#title' => $this->t('Error URL'), '#default_value' => $ice_config->get('url.err'), '#description' => $this->t('When changed, do not forget to change it on your ICEPAY merchant account.'), '#field_prefix' => $base_url . '/');
$form['icepay_url']['uc_icepay_url_notify'] = array('#type' => 'textfield', '#title' => $this->t('Notify / Postback URL'), '#default_value' => $ice_config->get('url.notify'), '#description' => $this->t('When changed, do not forget to change it on your ICEPAY merchant account.'), '#field_prefix' => $base_url . '/');
$form['icepay_disclaimer'] = array('#type' => 'details', '#title' => $this->t('Disclaimer'), '#description' => $this->t("The merchant is entitled to change de ICEPAY plug-in code, any changes will be at merchant's own risk.") . '<br>' . $this->t("Requesting ICEPAY support for a modified plug-in will be charged in accordance with the standard ICEPAY rates."), '#open' => true, 'icepay_support_link' => array('#type' => 'item', '#markup' => $this->t('For ICEPAY technical suppport, !link', ['!link' => '<a href="https://icepay.com/support" target="_blank">https://icepay.com/support</a>'])));
$form['icepay_ideal_issuers'] = array('#type' => 'details', '#title' => t('iDeal issuers'), '#description' => t('You can set which iDeal issuers to be made available as option during checkout process.'), '#weight' => 6);
$static = new IcepayStatics();
foreach ($static->getIdealIssuersOption() as $code => $issuer) {
$form['icepay_ideal_issuers']['uc_icepay_ideal_issuer_' . $code] = array('#type' => 'checkbox', '#title' => $issuer, '#default_value' => $ice_config->get('ideal_issuer.' . $code));
}
return $form;
}
开发者ID:winnie80,项目名称:uc_icepay,代码行数:37,代码来源:IcepaySettingsForm.php
示例12: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL)
{
$config = $this->config('easychart.settings');
$load_defaults = FALSE;
// Get defaults.
foreach ($this->getDefaults() as $default) {
// Verify default options.
$default_value = $config->get($default);
if (empty($default_value)) {
// Set flag to true.
$load_defaults = TRUE;
$form['#attached']['drupalSettings']['easychart'][$default] = TRUE;
}
}
if ($load_defaults) {
$form['#attached']['library'][] = 'easychart/easychart.defaults';
$form['#attached']['library'][] = 'easychart/lib.easycharts.full';
}
$options = $config->get('options');
$form['options'] = ['#type' => 'textarea', '#title' => $this->t('Available options'), '#description' => $this->t('These Highcharts options will be configurable in the Easychart interface when creating/editing a chart. See <a href="@url" target="_blank">http://api.highcharts.com/highcharts</a> for all available options.', array('@url' => Url::fromUri('http://api.highcharts.com/highcharts')->toUriString())), '#default_value' => $options, '#attributes' => array('class' => array('easychart-options')), '#rows' => 15];
$form['templates'] = ['#type' => 'textarea', '#title' => t('Available templates'), '#default_value' => $config->get('templates'), '#description' => t("These templates will be selectable in the Easychart interface when creating/editing a chart."), '#attributes' => array('class' => array('easychart-templates')), '#rows' => 15];
$form['presets'] = ['#type' => 'textarea', '#title' => t('Presets'), '#default_value' => $config->get('presets'), '#description' => $this->t('Presets for every Easychart chart. If these preset are also mentioned in the available options, they will be shown, but not editable.'), '#attributes' => array('class' => array('easychart-presets')), '#rows' => 10];
$interval = array(3600, 10800, 21600, 32400, 43200, 86400, 172800);
$form['url_update_frequency'] = ['#type' => 'select', '#title' => t('Update frequency'), '#options' => array(0 => t('Never')) + array_map([\Drupal::service('date.formatter'), 'formatInterval'], array_combine($interval, $interval)), '#default_value' => $config->get('url_update_frequency'), '#description' => $this->t('When to update the data for charts using a CSV URL.'), '#rows' => 10];
$form['actions']['reset'] = ['#type' => 'submit', '#value' => t('Reset to defaults'), '#submit' => array('::resetForm'), '#limit_validation_errors' => array(), '#weight' => 100];
return parent::buildForm($form, $form_state);
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:30,代码来源:SettingsForm.php
示例13: __construct
/**
* Constructs a \Drupal\system\CustomFieldFormBase object.
*
* @param \Drupal\Core\Config\ConfigFactory $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Entity\EntityTypeManager
* The entity type manager.
* @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface
* The cache invalidator.
* @param \Drupal\Core\Extension\ModuleHandler
* The module handler.
*/
public function __construct(ConfigFactory $config_factory, EntityTypeManagerInterface $entity_type_manager, CacheTagsInvalidatorInterface $cache_invalidator, ModuleHandler $module_handler)
{
parent::__construct($config_factory);
$this->entityTypeManager = $entity_type_manager;
$this->cacheInvalidator = $cache_invalidator;
$this->moduleHandler = $module_handler;
}
开发者ID:neeravbm,项目名称:unify-d8,代码行数:19,代码来源:FieldFormBase.php
示例14: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
// Remove unnecessary values.
form_state_values_clean($form_state);
$this->config('faq.settings')->set('display', $form_state['values']['faq_display'])->set('question_listing', $form_state['values']['faq_question_listing'])->set('qa_mark', $form_state['values']['faq_qa_mark'])->set('question_label', $form_state['values']['faq_question_label'])->set('answer_label', $form_state['values']['faq_answer_label'])->set('question_length', $form_state['values']['faq_question_length'])->set('question_long_form', $form_state['values']['faq_question_long_form'])->set('hide_qa_accordion', $form_state['values']['faq_hide_qa_accordion'])->set('show_expand_all', $form_state['values']['faq_show_expand_all'])->set('use_teaser', $form_state['values']['faq_use_teaser'])->set('back_to_top', $form_state['values']['faq_back_to_top'])->set('disable_node_links', $form_state['values']['faq_disable_node_links'])->set('default_sorting', $form_state['values']['faq_default_sorting'])->save();
parent::submitForm($form, $form_state);
}
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:10,代码来源:QuestionsForm.php
示例15: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->config('logouttab.settings')
->set('url', $form_state->getValue('url'))
->set('weight', $form_state->getValue('weight'))
->save();
}
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:10,代码来源:LogouttabSettingsForm.php
示例16: submitForm
/**
* @inheritDoc
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
// Get form variable values.
$config = $this->config(self::SETTINGS);
$config->set('window_target', $form_state->getValue('window_target'));
parent::submitForm($form, $form_state);
}
开发者ID:bonrita,项目名称:moodle,代码行数:10,代码来源:CourseSettingsForm.php
示例17: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL)
{
$current_path = $request->attributes->get('_system_path');
$current_url = Url::createFromRequest($request);
$devel_config = $this->config('devel.settings');
$form['queries'] = array('#type' => 'fieldset', '#title' => t('Query log'));
$description = t('Display a log of the database queries needed to generate the current page, and the execution time for each. Also, queries which are repeated during a single page view are summed in the # column, and printed in red since they are candidates for caching.');
$form['queries']['query_display'] = array('#type' => 'checkbox', '#title' => t('Display query log'), '#default_value' => $devel_config->get('query_display'), '#description' => $description);
$form['queries']['settings'] = array('#type' => 'container', '#states' => array('invisible' => array('input[name="query_display"]' => array('checked' => FALSE))));
$form['queries']['settings']['query_sort'] = array('#type' => 'radios', '#title' => t('Sort query log'), '#default_value' => $devel_config->get('query_sort'), '#options' => array(t('by source'), t('by duration')), '#description' => t('The query table can be sorted in the order that the queries were executed or by descending duration.'));
$form['queries']['settings']['execution'] = array('#type' => 'textfield', '#title' => t('Slow query highlighting'), '#default_value' => $devel_config->get('execution'), '#size' => 4, '#maxlength' => 4, '#description' => t('Enter an integer in milliseconds. Any query which takes longer than this many milliseconds will be highlighted in the query log. This indicates a possibly inefficient query, or a candidate for caching.'));
$form['api_url'] = array('#type' => 'textfield', '#title' => t('API Site'), '#default_value' => $devel_config->get('api_url'), '#description' => t('The base URL for your developer documentation links. You might change this if you run <a href="!url">api.module</a> locally.', array('!url' => Url::fromUri('http://drupal.org/project/api')->toString())));
$form['timer'] = array('#type' => 'checkbox', '#title' => t('Display page timer'), '#default_value' => $devel_config->get('timer'), '#description' => t('Display page execution time in the query log box.'));
$form['memory'] = array('#type' => 'checkbox', '#title' => t('Display memory usage'), '#default_value' => $devel_config->get('memory'), '#description' => t('Display how much memory is used to generate the current page. This will show memory usage when devel_init() is called and when devel_exit() is called.'));
$form['redirect_page'] = array('#type' => 'checkbox', '#title' => t('Display redirection page'), '#default_value' => $devel_config->get('redirect_page'), '#description' => t('When a module executes drupal_goto(), the query log and other developer information is lost. Enabling this setting presents an intermediate page to developers so that the log can be examined before continuing to the destination page.'));
$form['page_alter'] = array('#type' => 'checkbox', '#title' => t('Display $page array'), '#default_value' => $devel_config->get('page_alter'), '#description' => t('Display $page array from <a href="http://api.drupal.org/api/function/hook_page_alter/7">hook_page_alter()</a> in the messages area of each page.'));
$form['raw_names'] = array('#type' => 'checkbox', '#title' => t('Display machine names of permissions and modules'), '#default_value' => $devel_config->get('raw_names'), '#description' => t('Display the language-independent machine names of the permissions in mouse-over hints on the !Permissions page and the module base file names on the @Permissions and !Modules pages.', array('!Permissions' => $this->l(t('Permissions'), Url::fromRoute('user.admin_permissions')), '@Permissions' => t('Permissions'), '!Modules' => $this->l(t('Modules'), Url::fromRoute('system.modules_list')))));
$error_handlers = devel_get_handlers();
$form['error_handlers'] = array('#type' => 'select', '#title' => t('Error handlers'), '#options' => array(DEVEL_ERROR_HANDLER_NONE => t('None'), DEVEL_ERROR_HANDLER_STANDARD => t('Standard Drupal'), DEVEL_ERROR_HANDLER_BACKTRACE_DPM => t('Krumo backtrace in the message area'), DEVEL_ERROR_HANDLER_BACKTRACE_KRUMO => t('Krumo backtrace above the rendered page')), '#multiple' => TRUE, '#default_value' => empty($error_handlers) ? DEVEL_ERROR_HANDLER_NONE : $error_handlers, '#description' => SafeMarkup::set(t('Select the error handler(s) to use, in case you <a href="@choose">choose to show errors on screen</a>.', array('@choose' => $this->url('system.logging_settings'))) . '<ul>' . '<li>' . t('<em>None</em> is a good option when stepping through the site in your debugger.') . '</li>' . '<li>' . t('<em>Standard Drupal</em> does not display all the information that is often needed to resolve an issue.') . '</li>' . '<li>' . t('<em>Krumo backtrace</em> displays nice debug information when any type of error is noticed, but only to users with the %perm permission.', array('%perm' => t('Access developer information'))) . '</li></ul>' . t('Depending on the situation, the theme, the size of the call stack and the arguments, etc., some handlers may not display their messages, or display them on the subsequent page. Select <em>Standard Drupal</em> <strong>and</strong> <em>Krumo backtrace above the rendered page</em> to maximize your chances of not missing any messages.') . '<br />' . t('Demonstrate the current error handler(s):') . ' ' . $this->l('notice', $current_url, array('query' => array('demo' => 'notice'))) . ', ' . $this->l('notice+warning', $current_url, array('query' => array('demo' => 'warning'))) . ', ' . $this->l('notice+warning+error', $current_url, array('query' => array('demo' => 'error'))) . ' ' . t('(The presentation of the @error is determined by PHP.)', array('@error' => 'error'))));
$form['error_handlers']['#size'] = count($form['error_handlers']['#options']);
if ($request->query->has('demo')) {
if ($request->getMethod() == 'GET') {
$this->demonstrateErrorHandlers($request->query->get('demo'));
}
$request->query->remove('demo');
}
$options = array('default', 'blue', 'green', 'orange', 'white', 'disabled');
$form['krumo_skin'] = array('#type' => 'radios', '#title' => t('Krumo display'), '#description' => t('Select a skin for your debug messages or select <em>disabled</em> to display object and array output in standard PHP format.'), '#options' => array_combine($options, $options), '#default_value' => $devel_config->get('krumo_skin'));
$form['rebuild_theme'] = array('#type' => 'checkbox', '#title' => t('Rebuild the theme information like the registry'), '#description' => t('While creating new templates, change the $theme.info.yml and theme_ overrides the theme information needs to be rebuilt.'), '#default_value' => $devel_config->get('rebuild_theme'));
$form['use_uncompressed_jquery'] = array('#type' => 'checkbox', '#title' => t('Use uncompressed jQuery'), '#default_value' => $devel_config->get('use_uncompressed_jquery'), '#description' => t("Use a human-readable version of jQuery instead of the minified version that ships with Drupal, to make JavaScript debugging easier."));
return parent::buildForm($form, $form_state);
}
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:35,代码来源:SettingsForm.php
示例18: submitForm
public function submitForm(array &$form, FormStateInterface $form_state)
{
$config = $this->config('spectrum.settings');
$config->set('sendgrid_api_key', $form_state->getValue('sendgrid_api_key'));
$config->save();
parent::submitForm($form, $form_state);
}
开发者ID:pjcarly,项目名称:drupal8-spectrum,代码行数:7,代码来源:AdminSettingsForm.php
示例19: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$config = $this->config('tweets.settings');
$config->set('twitter_secret_key', $form_state->getValue('twitter_secret_key'))->set('twitter_api_key', $form_state->getValue('twitter_api_key'))->set('twitter_access_api_key', $form_state->getValue('twitter_access_api_key'))->set('twitter_access_secret_key', $form_state->getValue('twitter_access_secret_key'))->set('twitter_username', $form_state->getValue('twitter_username'))->set('max_tweets', $form_state->getValue('max_tweets'));
$config->save();
parent::submitForm($form, $form_state);
}
开发者ID:systemick3,项目名称:systemick.co.uk,代码行数:10,代码来源:TweetsSettingsForm.php
示例20: submitForm
/**
* Submit callback.
*
* Implements the form logic.
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$this->config('happy_alexandrie.library_config')->set('opening_hours', $form_state->getValue('opening_hours'))->save();
// Call the parent implementation to inherit from what has been done in it.
// In our case, display the confirmation message.
parent::submitForm($form, $form_state);
}
开发者ID:Happyculture,项目名称:exercices,代码行数:12,代码来源:AlexandrieConfigForm.php
注:本文中的Drupal\Core\Form\ConfigFormBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版 |
请发表评论