Skip to content

Commit

Permalink
PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
komejo committed Sep 13, 2024
1 parent aa491fe commit 021d399
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/wri_zoom/src/Plugin/WebFormElement/IPAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\wri_zoom\Plugin\WebformElement;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElementBase;
use Drupal\webform\WebformSubmissionInterface;
use Drupal\Core\Form\FormStateInterface;

/**
* Provides an 'ip_address' webform element.
Expand Down Expand Up @@ -36,7 +36,8 @@ public function getValue(array $element, WebformSubmissionInterface $webform_sub

// Check if the webform has a remote address.
if ($this->getWebform()->hasRemoteAddr()) {
// Prefer 'X-Forwarded-For' header, but fall back to 'remote_addr' if it's not present.
// Prefer 'X-Forwarded-For' header, but fall
// back to 'remote_addr' if it's not present.
$ip_address = $request->headers->has('X-Forwarded-For')
? trim(explode(',', $request->headers->get('X-Forwarded-For'))[0])
: $request->getClientIp();
Expand Down Expand Up @@ -76,4 +77,5 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$form = parent::buildConfigurationForm($form, $form_state);
return $form;
}

}

0 comments on commit 021d399

Please sign in to comment.