You are here

class AdminConfigureForm in IP Geolocation Views & Maps 8

Pending doc.

Hierarchy

Expanded class hierarchy of AdminConfigureForm

1 string reference to 'AdminConfigureForm'
ip_geoloc.routing.yml in ./ip_geoloc.routing.yml
ip_geoloc.routing.yml

File

src/Form/AdminConfigureForm.php, line 16

Namespace

Drupal\ip_geoloc\Form
View source
class AdminConfigureForm extends ConfigFormBase {
  protected $messenger;
  protected $connection;
  protected $ipGeolocSession;

  /**
   * Constructs a \Drupal\ip_geoloc\Form\AdminConfigureForm object.
   */
  public function __construct(ConfigFactoryInterface $config_factory, MessengerInterface $messenger, Connection $connection, IpGeoLocSession $ipGeolocSession) {
    parent::__construct($config_factory);
    $this->messenger = $messenger;
    $this->connection = $connection;
    $this->ipGeolocSession = $ipGeolocSession;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('config.factory'), $container
      ->get('messenger'), $container
      ->get('database'), $container
      ->get('ip_geoloc.session'));
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'ip_geoloc.settings',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'ip_geoloc_admin_configure';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    global $base_url;
    $config = $this
      ->config('ip_geoloc.settings');
    $form['ip_geoloc_google_auth'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Authentication of maps and geolocation services'),
      '#description' => $this
        ->t('The <a target="_blank" href="!url1">Google Maps API</a>, which include geolocation services, requires either a Google API Key or a Google Client ID. <br/>If you are using <a target="_blank" href="!url2">Leaflet maps</a> you may still need a Google API Key or Client ID when you use this module\'s geolocation services also.', [
        '!url1' => 'https://developers.google.com/maps/documentation/javascript/get-api-key',
        '!url2' => 'http://leafletjs.com',
      ]),
    ];
    $form['ip_geoloc_google_auth']['ip_geoloc_auth_method'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Select Google API Authentication Method'),
      '#description' => $this
        ->t('Google API Authentication Method'),
      '#default_value' => $config
        ->get('ip_geoloc_auth_method') ? $config
        ->get('ip_geoloc_auth_method') : 1,
      '#options' => [
        1 => $this
          ->t('API Key'),
        2 => $this
          ->t('Client ID'),
      ],
    ];
    $form['ip_geoloc_google_auth']['ip_geoloc_apikey'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Google Maps API Key'),
      '#description' => $this
        ->t('Obtain a Google Maps Javascript API key <a href="!url">here</a>.', [
        '!url' => 'https://developers.google.com/maps/documentation/javascript/get-api-key',
      ]),
      '#default_value' => $config
        ->get('ip_geoloc_apikey') ? $config
        ->get('ip_geoloc_apikey') : '',
      '#required' => FALSE,
      '#states' => [
        'visible' => [
          ':input[name="ip_geoloc_auth_method"]' => [
            'value' => 1,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_google_auth']['ip_geoloc_client_id'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Google Client ID'),
      '#description' => $this
        ->t('For more information, visit <a href="!url">this page</a>.', [
        '!url' => 'https://developers.google.com/maps/documentation/javascript/get-api-key#client-id',
      ]),
      '#default_value' => $config
        ->get('ip_geoloc_client_id') ? $config
        ->get('ip_geoloc_client_id') : '',
      '#required' => FALSE,
      '#states' => [
        'visible' => [
          ':input[name="ip_geoloc_auth_method"]' => [
            'value' => 2,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_google_auth']['ip_geoloc_signature'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Google Signature'),
      '#description' => $this
        ->t('May not be required. Check the Google documentation.'),
      '#default_value' => $config
        ->get('ip_geoloc_signature') ? $config
        ->get('ip_geoloc_signature') : '',
      '#required' => FALSE,
      '#states' => [
        'visible' => [
          ':input[name="ip_geoloc_auth_method"]' => [
            'value' => 2,
          ],
        ],
      ],
    ];
    $form['markers'] = [
      '#type' => 'details',
      '#open' => FALSE,
      '#title' => $this
        ->t('Alternative markers'),
    ];
    $markers_path = drupal_get_path('module', 'ip_geoloc');
    $form['markers']['ip_geoloc_marker_directory'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('<strong>Google Maps, Leaflet</strong>: path to marker images'),
      '#field_prefix' => "{$base_url}/",
      '#default_value' => ip_geoloc_marker_directory(),
      '#description' => $this
        ->t('Marker sets included with the module reside in %set1 and %set2. All marker images must be .png files.', [
        '%set1' => "{$markers_path}/markers",
        '%set2' => "{$markers_path}/amarkers",
      ]),
    ];
    $form['markers']['ip_geoloc_marker_dimensions'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('<strong>Google Maps, Leaflet</strong>: marker image width and height'),
      '#default_value' => ip_geoloc_marker_dimensions(),
      '#field_suffix' => $this
        ->t('px'),
      '#description' => $this
        ->t('These dimensions apply to all markers in the set. The default marker size is 21 x 34 for the <em>/markers</em> directory and 32 x 42 for the <em>/amarkers</em> directory.'),
    ];
    $form['markers']['ip_geoloc_marker_anchor_pos'] = [
      '#title' => $this
        ->t('<strong>Google Maps, Leaflet</strong>: marker image anchor position'),
      '#type' => 'select',
      '#default_value' => $config
        ->get('ip_geoloc_marker_anchor_pos') ? $config
        ->get('ip_geoloc_marker_anchor_pos') : 'bottom',
      '#options' => [
        'top' => $this
          ->t('Center of topline'),
        'middle' => $this
          ->t('Center of image'),
        'bottom' => $this
          ->t('Center of baseline'),
      ],
      '#description' => $this
        ->t('This anchor position is applied to all markers in the set.'),
    ];
    $form['markers']['ip_geoloc_num_location_marker_layers'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('<strong>OpenLayers only</strong>: maximum number of marker layers you may need'),
      '#default_value' => $config
        ->get('ip_geoloc_num_location_marker_layers') ? $config
        ->get('ip_geoloc_num_location_marker_layers') : IP_GEOLOC_DEF_NUM_MARKER_LAYERS,
      '#description' => $this
        ->t('Only relevant when you have selected "differentiator" fields in your view.'),
    ];
    $benefits = $this
      ->t('Some of the benefits of font icons are explained <a target="flink" href="!url_flink">here</a>.', [
      '!url_flink' => 'http://flink.com.au/ramblings/spruce-your-map-markers-font-icons',
    ]);
    $form['font_icons'] = [
      '#type' => 'details',
      '#open' => FALSE,
      '#title' => $this
        ->t('Font icons (Leaflet only)'),
      '#description' => $benefits . '<br/>' . $this
        ->t('If you decide to use them, a good spot to put the font icon libraries you choose to download is in subdirectories of %url_libs.<br/>Each font icon library normally contains a CSS file through which other files in the library are found. Type the filespec of those CSS files below, one per library. After you have saved the configuration, check the <a target="status" href="!url_status">status report</a> page for errors.<br/><strong>Example 1</strong>, <a target="fontawesome" href="!url_fontawesome">Font Awesome</a>: %css_file1 <br/><strong>Example 2</strong>, <a target="flaticon" href="!url_flaticon">flaticon</a>: %css_file2', [
        '%url_libs' => '/sites/all/libraries',
        '!url_fontawesome' => 'http://fortawesome.github.io/Font-Awesome',
        '%css_file1' => 'sites/all/libraries/font-awesome/css/font-awesome.min.css',
        '!url_flaticon' => 'http://flaticon.com',
        '%css_file2' => 'sites/all/libraries/flaticon/food-icons/flaticon.css',
        '!url_status' => 'admin/reports/status',
      ]),
    ];
    $libs = ip_geoloc_get_font_icon_libs();
    $count = max(2, min(count($libs) + 1, IP_GEOLOC_MAX_NUM_FONT_ICON_LIBS));
    for ($i = 1; $i <= $count; $i++) {
      $form['font_icons']["ip_geoloc_font_icon_lib{$i}"] = [
        '#type' => 'textfield',
        '#field_prefix' => "{$base_url}/",
        '#title' => $this
          ->t('Main CSS file belonging to font icon library #@i', [
          '@i' => $i,
        ]),
        '#default_value' => empty($libs[$i]) ? '' : $libs[$i],
      ];
    }
    $form['font_icons']["ip_geoloc_font_icon_lib{$count}"]['#description'] = $this
      ->t('<strong>Note:</strong> as explained in this <a target="issue" href="!url_issue">issue</a>, you cannot have identical leaf names amongst the CSS filespecs. Rename .css files if there are clashes.', [
      '!url_issue' => 'https://www.drupal.org/node/1885838#comment-8996119',
    ]);
    if ($this
      ->ipGeoLocDiagnose() > 0) {

      // Form for sync-ing the geolocation table with the system accesslog.
      $form['ip_geoloc_db_options'] = [
        '#type' => 'details',
        '#open' => FALSE,
        '#title' => $this
          ->t('Update IP geolocation database using past visitor IP addresses from the system access log'),
        '#description' => $this
          ->t('You can update the IP geolocation database in batches by pressing the button below. As a rough guide, count on a 1 minute wait for every 100 IP addresses, when executing a web service like IPInfoDB, as employed by Smart IP. Add another 2 minutes per 100 IP addresses if you ticked the option to employ the Google Maps API to reverse-geocode to street addresses. If your server interrupts the process you can continue from where it stopped by refreshing this page and pressing the button again. You will not lose any data.'),
      ];
      $form['ip_geoloc_db_options']['ip_geoloc_sync_with_accesslog'] = [
        '#type' => 'submit',
        '#value' => $this
          ->t('Update now'),
        '#submit' => [
          'ip_geoloc_sync_with_accesslog',
        ],
      ];
      $form['ip_geoloc_db_options']['ip_geoloc_sync_batch_size'] = [
        '#type' => 'textfield',
        '#size' => 4,
        '#title' => $this
          ->t('Batch size'),
        '#default_value' => $config
          ->get('ip_geoloc_sync_batch_size') ? $config
          ->get('ip_geoloc_sync_batch_size') : 500,
        '#description' => $this
          ->t('To change the default batch size, press "Save configuration".'),
      ];
    }
    $form['ip_geoloc_data_collection_options'] = [
      '#type' => 'details',
      '#open' => FALSE,
      '#title' => $this
        ->t('Data collection options'),
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_allow_session_storage'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Allow session storage'),
      '#default_value' => $config
        ->get('ip_geoloc_allow_session_storage'),
      '#description' => $this
        ->t('The current visitor\'s location data is temporarily stored in either the $_SESSION variable or via the module <a target="_project" href="@url_project">Session Cache API</a>, if enabled. <br/>To disable both of these session storage functions, untick this box. However unticking this box means you will lose all functions regarding Wifi/GPS-based visitor geolocation. Location of the visitor based on IP address through either the <strong>Smart IP</strong> or <strong>GeoIP</strong> modules will continue to operate normally, if enabled.', [
        '@url_project' => 'http://drupal.org/project/session_cache',
      ]),
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_store_addresses'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Store reverse-geocoded addresses with their corresponding latitude/longitude on the database'),
      '#default_value' => $config
        ->get('ip_geoloc_store_addresses'),
      '#description' => $this
        ->t('This allows you to create maps of recent visitors to your site.'),
    ];
    $note1 = $this
      ->t('Untick, if you do not need periodic visitor location updates. Consider the <em>Set my location</em> block as an alternative.');
    $note2 = $this
      ->t('You can also use the <a href="@project_context">Context module</a> to conditionally geolocate the visitor based on device type, page visited etc.', [
      '@project_context' => 'http://drupal.org/project/context',
    ]);

    // $this->t('Used in conjunction with the options below.');.
    $note3 = '';
    $form['ip_geoloc_data_collection_options']['ip_geoloc_google_to_reverse_geocode'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Employ a free Google service to <em>periodically</em> auto reverse-geocode visitor locations to street addresses'),
      '#default_value' => $config
        ->get('ip_geoloc_google_to_reverse_geocode'),
      '#description' => "{$note1}<br>{$note2}<br/>" . $this
        ->t('Reverse-geocoding takes place via the Javascript version of the Google Maps API and the HTML5 way of obtaining a visitor\'s location. This involves visitors being prompted to accept sharing of their location.<br/>For the upload of historic visitor location data the server-side version of the Google Maps API is used. The latter is subject to a Google-imposed daily limit on the number of calls coming from the same server.') . '<br/>' . $note3,
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_location_check_interval'] = [
      '#type' => 'textfield',
      '#size' => 10,
      '#field_suffix' => $this
        ->t('seconds'),
      '#title' => $this
        ->t('Minimum elapsed time before geolocation data for the same user will be collected again'),
      '#default_value' => $config
        ->get('ip_geoloc_location_check_interval') ? $config
        ->get('ip_geoloc_location_check_interval') : IP_GEOLOC_LOCATION_CHECK_INTERVAL,
      '#description' => $this
        ->t('Operates in combination with the checkbox above. Geolocation information associated with an IP address may change over time, for instance when the visitor is using a mobile device and is moving. Use zero to geolocate the visitor <em>once</em> and then refrain from repeat location collection until their session has expired.'),
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_include_pages'] = [
      '#type' => 'textarea',
      '#rows' => 2,
      '#title' => $this
        ->t("Pages on which the visitor's HTML5 location may be sampled and reverse-geocoded to a street address"),
      '#default_value' => $config
        ->get('ip_geoloc_include_pages') ? $config
        ->get('ip_geoloc_include_pages') : '*',
      '#description' => $this
        ->t("Enter relative paths, one per line. Where they exist use the URL aliases rather than the node numbers. <strong>&lt;front&gt;</strong> means the front page.<br/>The asterisk <em>*</em> is the wildcard character, i.e. <em>recipes/mains*</em> denotes all pages that have a path starting with <em>recipes/mains</em><br/>The asterisk by itself means any page on your site."),
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_exclude_pages'] = [
      '#type' => 'textarea',
      '#rows' => 3,
      '#title' => $this
        ->t('Exceptions: pages excluded from the set of pages specified above'),
      '#default_value' => $config
        ->get('ip_geoloc_exclude_pages') ? $config
        ->get('ip_geoloc_exclude_pages') : IP_GEOLOC_DEFAULT_PAGE_EXCLUSIONS,
      '#description' => $this
        ->t('As above, one path specification per line.'),
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_roles_to_reverse_geocode'] = [
      '#type' => 'checkboxes',
      '#title' => $this
        ->t("User roles for which the HTML5 location may be sampled and reverse-geocoded to a street address"),
      '#default_value' => $config
        ->get('ip_geoloc_roles_to_reverse_geocode') ? $config
        ->get('ip_geoloc_roles_to_reverse_geocode') : [
        DRUPAL_ANONYMOUS_RID,
        DRUPAL_AUTHENTICATED_RID,
      ],
      '#options' => user_role_names(),
      '#description' => $this
        ->t('Selected roles are effective only when the check box on the data collection option above is also ticked.'),
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_smart_ip_as_backup'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Employ Smart IP as a backup to the Google Maps JS API as well as declined or failed HTML5 location retrievals in Views'),
      '#default_value' => $config
        ->get('ip_geoloc_smart_ip_as_backup'),
      '#description' => $this
        ->t('This refers to situations where the lat/long coords could not be established. An example is the user declining to share their location. Another is when the Google Maps API reverse-geocode function fails or is not enabled through the tick box at the top of this section.<br/>Smart IP lookups tend to be less detailed than the Google Maps reverse-geocoded results.<br/>If this box is <strong>not</strong> ticked, but the <a href="@geoip">GeoIP API module</a> is enabled, then GeoIP will be used as the Google Maps API fallback and to load historic lat/long coordinates.', [
        '@geoip' => 'http://drupal.org/project/geoip',
      ]),
      '#states' => [
        'visible' => [
          'input[name="ip_geoloc_allow_session_storage"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['ip_geoloc_data_collection_options']['ip_geoloc_throbber_text2'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Message displayed while visitor is being geolocated'),
      '#size' => 30,
      '#default_value' => $config
        ->get('ip_geoloc_throbber_text2') ? $config
        ->get('ip_geoloc_throbber_text2') : '',
      '#description' => $this
        ->t('A standard status message to show the visitor that geolocation was initiated and is in progress. </br/>Defaults to %default <br/>You may use most HTML tags. Use <em>&lt;none&gt;</em> to have no message shown, which is probably the preferred choice if the <strong>Auto-refresh</strong> box below is unticked.', [
        '%default' => IP_GEOLOC_THROBBER_DEFAULT_TEXT,
      ]),
    ];
    $form['ip_geoloc_advanced'] = [
      '#type' => 'details',
      '#open' => FALSE,
      '#title' => $this
        ->t('Advanced options'),
    ];
    $form['ip_geoloc_advanced']['ip_geoloc_page_refresh'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Auto-refresh the page as soon as an HTML5 location update has come in'),
      '#default_value' => $config
        ->get('ip_geoloc_page_refresh') ? $config
        ->get('ip_geoloc_page_refresh') : TRUE,
      '#description' => $this
        ->t('The above tick box does not apply to administration pages.'),
    ];
    $form['ip_geoloc_advanced']['ip_geoloc_debug'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Detail execution progress with status messages'),
      '#default_value' => $config
        ->get('ip_geoloc_debug'),
      '#description' => $this
        ->t('Enter a comma-separated list of names of users that should see status messages coming from this module, e.g., for debugging purposes. Use <strong>anon</strong> for the anonymous user.'),
    ];
    $form['ip_geoloc_advanced']['ip_geoloc_erase_session'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Erase geolocation data from session now'),
      '#submit' => [
        '::ipGeoLocEraseSession',
      ],
    ];
    $form['ip_geoloc_advanced']['ip_geoloc_erase_db'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Erase entire IP geolocation database now'),
      '#submit' => [
        '::ipGeoLocEraseDb',
      ],
    ];
    return parent::buildForm($form, $form_state);
  }

  /**
   * Report on the configuration status.
   *
   * Reports in particular to the system access log, which is required for
   * visitor views and maps.
   *
   * @return int
   *   Value -1, if there's a problem, otherwise a count of IP addresses not stored
   */
  public function ipGeoLocDiagnose() {

    // $this->messenger->addMessage($message, $type)
    $geoloc_count = $this->connection
      ->query('SELECT COUNT(DISTINCT ip_address) FROM ip_geoloc')
      ->fetchField();
    $this->messenger
      ->addMessage($this
      ->t("The IP geolocation database currently contains information for %geoloc_count visited IP addresses.", [
      '%geoloc_count' => $geoloc_count,
    ]), 'status', FALSE);

    // Access log table doesn't exists anymore

    /*if (!$this->connection->schema()->tableExists($table)('accesslog')) {
      $this->messenger->addMessage($this->t("The <strong>accesslog</strong> database table does not exist, probably because core's <strong>Statistics</strong> module is not enabled. Views and maps of visitors will not be available until you enable the <strong>Statistics</strong> module and its <strong>access log</strong>. The visitor location map blocks are not affected and should still display."), 'warning');
      }
      elseif (!\Drupal::moduleHandler()->moduleExists('statistics')) {
      $this->messenger->addMessage($this->t('The <strong>Statistics</strong> module is not enabled. Views and maps of visitors will not be available or display errors until you enable the <strong>Statistics</strong> module and its <strong>access log</strong>. The visitor location map blocks are not affected and should still display.'), 'warning');
      }
      else {
      $ip_address_count = $this->connection->query('SELECT COUNT(DISTINCT hostname) FROM {accesslog}')->fetchField();
      $this->messenger->addMessage($this->t("The system access log currently contains entries from %ip_address_count IP addresses.", ['%ip_address_count' => $ip_address_count]), 'status', FALSE);
      if (!\Drupal::state()->get('statistics_enable_access_log', FALSE)) {
      $this->messenger->addMessage($this->t('The <strong>Statistics</strong> module is enabled, but its system <strong>access log</strong> is not. Therefore all visitor Views are frozen and will not grow. The visitor location map blocks are not affected and should still display. You can enable the <strong>access log</strong> at <a href="!url">Configuration >> Statistics</a>.',
      ['!url' => 'admin/config/system/statistics']), 'warning');
      }
      else {
      $non_synched_ips = ip_geoloc_ips_to_be_synched();
      $count = count($non_synched_ips);
      if ($count > 0) {
      $t = $this->t("%count IP addresses in the system access log currently have no associated lat/long or address information on the IP geolocation database. These are the most recent ones: %ips",
      [
      '%count' => $count,
      '%ips' => implode(', ', array_slice($non_synched_ips, 0, 10, TRUE)),
      ]);
      $this->messenger->addMessage($t, 'status', FALSE);
      }
      else {
      $this->messenger->addMessage($this->t("The IP geolocation database is up to date and in sync with the system access log."), 'status', FALSE);
      }
      return $count;
      }
      }*/
    return -1;
  }

  /**
   * Erase geoloc data from session.
   */
  public function ipGeoLocEraseSession() {
    $this->ipGeolocSession
      ->setSessionValue(FALSE);
    $this->messenger
      ->addMessage($this
      ->t('Geolocation data erased from session.'));
  }

  /**
   * Delete geoloc data from database.
   */
  public function ipGeoLocEraseDb() {

    // Wipe previous messages to avoid confusion.
    $this->connection
      ->delete('ip_geoloc')
      ->execute();
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    // print_r($form_state->getValues());die();
    $this
      ->config('ip_geoloc.settings')
      ->set('ip_geoloc_auth_method', $form_state
      ->getValue('ip_geoloc_auth_method'))
      ->set('ip_geoloc_apikey', $form_state
      ->getValue('ip_geoloc_apikey'))
      ->set('ip_geoloc_marker_directory', $form_state
      ->getValue('ip_geoloc_marker_directory'))
      ->set('ip_geoloc_client_id', $form_state
      ->getValue('ip_geoloc_client_id'))
      ->set('ip_geoloc_signature', $form_state
      ->getValue('ip_geoloc_signature'))
      ->set('ip_geoloc_marker_anchor_pos', $form_state
      ->getValue('ip_geoloc_marker_anchor_pos'))
      ->set('ip_geoloc_num_location_marker_layers', $form_state
      ->getValue('ip_geoloc_num_location_marker_layers'))
      ->set('ip_geoloc_sync_batch_size', $form_state
      ->getValue('ip_geoloc_sync_batch_size'))
      ->set('ip_geoloc_allow_session_storage', $form_state
      ->getValue('ip_geoloc_allow_session_storage'))
      ->set('ip_geoloc_store_addresses', $form_state
      ->getValue('ip_geoloc_store_addresses'))
      ->set('ip_geoloc_google_to_reverse_geocode', $form_state
      ->getValue('ip_geoloc_google_to_reverse_geocode'))
      ->set('ip_geoloc_location_check_interval', $form_state
      ->getValue('ip_geoloc_location_check_interval'))
      ->set('ip_geoloc_include_pages', $form_state
      ->getValue('ip_geoloc_include_pages'))
      ->set('ip_geoloc_exclude_pages', $form_state
      ->getValue('ip_geoloc_exclude_pages'))
      ->set('ip_geoloc_roles_to_reverse_geocode', $form_state
      ->getValue('ip_geoloc_roles_to_reverse_geocode'))
      ->set('ip_geoloc_smart_ip_as_backup', $form_state
      ->getValue('ip_geoloc_smart_ip_as_backup'))
      ->set('ip_geoloc_throbber_text2', $form_state
      ->getValue('ip_geoloc_throbber_text2'))
      ->set('ip_geoloc_page_refresh', $form_state
      ->getValue('ip_geoloc_page_refresh'))
      ->set('ip_geoloc_debug', $form_state
      ->getValue('ip_geoloc_debug'))
      ->save();
    parent::submitForm($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdminConfigureForm::$connection protected property
AdminConfigureForm::$ipGeolocSession protected property
AdminConfigureForm::$messenger protected property The messenger. Overrides MessengerTrait::$messenger
AdminConfigureForm::buildForm public function Form constructor. Overrides ConfigFormBase::buildForm
AdminConfigureForm::create public static function Instantiates a new instance of this class. Overrides ConfigFormBase::create
AdminConfigureForm::getEditableConfigNames protected function Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait::getEditableConfigNames
AdminConfigureForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
AdminConfigureForm::ipGeoLocDiagnose public function Report on the configuration status.
AdminConfigureForm::ipGeoLocEraseDb public function Delete geoloc data from database.
AdminConfigureForm::ipGeoLocEraseSession public function Erase geoloc data from session.
AdminConfigureForm::submitForm public function Form submission handler. Overrides ConfigFormBase::submitForm
AdminConfigureForm::__construct public function Constructs a \Drupal\ip_geoloc\Form\AdminConfigureForm object. Overrides ConfigFormBase::__construct
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormBase::validateForm public function Form validation handler. Overrides FormInterface::validateForm 62
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.