当前位置: 首页>>代码示例>>PHP>>正文


PHP ConfigFormBase::SubmitForm方法代码示例

本文整理汇总了PHP中Drupal\Core\Form\ConfigFormBase::SubmitForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFormBase::SubmitForm方法的具体用法?PHP ConfigFormBase::SubmitForm怎么用?PHP ConfigFormBase::SubmitForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Form\ConfigFormBase的用法示例。


在下文中一共展示了ConfigFormBase::SubmitForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $sl_config = \Drupal::config('sociallogin.settings');
     $apiKey = $sl_config->get('api_key');
     $apiSecret = $sl_config->get('api_secret');
     if ($apiKey == '') {
         $apiKey = '';
         $apiSecret = '';
     }
     module_load_include('inc', 'sociallogin');
     $data = get_authentication($apiKey, $apiSecret);
     if (isset($data['status']) && $data['status'] != 'status') {
         drupal_set_message($data['message'], $data['status']);
         return FALSE;
     }
     parent::SubmitForm($form, $form_state);
     $this->config('sso.settings')->set('sso_enable', $form_state->getValue('sso_enable'))->save();
 }
开发者ID:LoginRadius,项目名称:drupal-identity-module,代码行数:21,代码来源:SSOSettingsForm.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $sl_config = \Drupal::config('sociallogin.settings');
     $apiKey = $sl_config->get('api_key');
     $apiSecret = $sl_config->get('api_secret');
     if ($apiKey == '') {
         $apiKey = '';
         $apiSecret = '';
     }
     module_load_include('inc', 'sociallogin');
     $data = get_authentication($apiKey, $apiSecret);
     if (isset($data['status']) && $data['status'] != 'status') {
         drupal_set_message($data['message'], $data['status']);
         return FALSE;
     }
     parent::SubmitForm($form, $form_state);
     $this->config('socialprofiledata.settings')->set('profile_selection', $form_state->getValue('profile_selection'))->set('show_profile', $form_state->getValue('show_profile'))->save();
     $socialprofiledata_profile_selection = explode(',', implode(',', $form_state->getValue('profile_selection', '')));
     module_load_include('inc', 'socialprofiledata', 'socialprofiledata.sql');
     if (in_array('basic_profile_data', $socialprofiledata_profile_selection)) {
         $this->socialprofiledata_check_table_exists_and_create('loginradius_basic_profile_data');
         $this->socialprofiledata_check_table_exists_and_create('loginradius_emails');
     }
     if (in_array('extended_profile_data', $socialprofiledata_profile_selection)) {
         $extended_profile_data_array = array('loginradius_extended_profile_data', 'loginradius_positions', 'loginradius_companies', 'loginradius_education', 'loginradius_phone_numbers', 'loginradius_IMaccounts', 'loginradius_addresses', 'loginradius_sports', 'loginradius_inspirational_people', 'loginradius_skills', 'loginradius_current_status', 'loginradius_certifications', 'loginradius_courses', 'loginradius_volunteer', 'loginradius_recommendations_received', 'loginradius_languages', 'loginradius_patents', 'loginradius_favorites', 'loginradius_books', 'loginradius_games', 'loginradius_television_show', 'loginradius_movies');
         if (is_array($extended_profile_data_array)) {
             foreach ($extended_profile_data_array as $table_name) {
                 $this->socialprofiledata_check_table_exists_and_create($table_name);
             }
         }
     }
     $create_table = array('extended_location_data' => 'loginradius_extended_location_data', 'followed_companies_on' => 'loginradius_linkedin_companies', 'facebook_profile_likes' => 'loginradius_facebook_likes', 'facebook_profile_events' => 'loginradius_facebook_events', 'status_message' => 'loginradius_status', 'facebook_posts' => 'loginradius_facebook_posts', 'twitter_mentions' => 'loginradius_twitter_mentions', 'lr_groups' => 'loginradius_groups', 'lr_contacts' => 'loginradius_contacts');
     foreach ($create_table as $table_key => $table_name) {
         $this->socialprofiledata_check_table_selected_in_database($table_key, $table_name, $socialprofiledata_profile_selection);
     }
     drupal_set_message(t('Social Profile data 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,代码行数:46,代码来源:SocialProfileDataSettingsForm.php

示例4: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = $this->config('captcha.settings');
     $config->set('administration_mode', $form_state->getValue('administration_mode'));
     $config->set('allow_on_admin_pages', $form_state->getValue('allow_on_admin_pages'));
     $config->set('default_challenge', $form_state->getValue('default_challenge'));
     // CAPTCHA description stuff.
     $config->set('add_captcha_description', $form_state->getValue('add_captcha_description'));
     // Save (or reset) the CAPTCHA descriptions.
     $config->set('description', $form_state->getValue('description'));
     $config->set('default_validation', $form_state->getValue('default_validation'));
     $config->set('persistence', $form_state->getValue('persistence'));
     $config->set('enable_stats', $form_state->getValue('enable_stats'));
     $config->set('log_wrong_responses', $form_state->getValue('log_wrong_responses'));
     $config->save();
     drupal_set_message(t('The CAPTCHA settings have been saved.'), 'status');
     parent::SubmitForm($form, $form_state);
 }
开发者ID:Wylbur,项目名称:gj,代码行数:21,代码来源:CaptchaSettingsForm.php

示例5: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if (!isset($form['image_captcha_font_settings']['no_ttf_support'])) {
         // Filter the image_captcha fonts array to pick out the selected ones.
         $fonts = array_filter($form_state->getValue('image_captcha_fonts'));
         $this->config('image_captcha.settings')->set('image_captcha_fonts', $fonts)->save();
     }
     parent::SubmitForm($form, $form_state);
 }
开发者ID:Wylbur,项目名称:gj,代码行数:12,代码来源:ImageCaptchaSettingsForm.php


注:本文中的Drupal\Core\Form\ConfigFormBase::SubmitForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。