You are here

public static function Securepages::matchFormId in Secure Pages 8

Match form identifier against forms configured.

Parameters

string $form_id: The form identifier.

Return value

bool Whether the form identifier matched the configured identifiers.

1 call to Securepages::matchFormId()
FormBuilder::buildFormAction in src/FormBuilder.php
Builds the $form['#action'].

File

src/Securepages.php, line 140
Contains \Drupal\securepages\Securepages.

Class

Securepages
Utility class for global functionality.

Namespace

Drupal\securepages

Code

public static function matchFormId($form_id) {
  $config = \Drupal::config('securepages.settings');
  $forms = Unicode::strtolower(implode("\n", $config
    ->get('forms')));

  /** @var \Drupal\Core\Path\PathMatcher $path_matcher */
  $path_matcher = \Drupal::service('path.matcher');
  if ($path_matcher
    ->matchPath($form_id, $forms)) {

    //Securepages::log('Secure Form (Form: "@path", Line: @line, Pattern: "@pattern")', $form_id, $forms);
    return TRUE;
  }
  return FALSE;
}