You are here

protected static function WebformOptionsLimitController::hasOptionsLimit in Webform 8.5

Determine if the webform has an options limit handler.

Parameters

\Drupal\webform\WebformInterface $webform: A webform.

Return value

bool TRUE if the webform has an options limit handler.

2 calls to WebformOptionsLimitController::hasOptionsLimit()
WebformOptionsLimitController::checkAccess in modules/webform_options_limit/src/Controller/WebformOptionsLimitController.php
Check whether the webform option limits summary.
WebformOptionsLimitController::checkNodeAccess in modules/webform_options_limit/src/Controller/WebformOptionsLimitController.php
Check whether the user can access a node's webform options limits summary.

File

modules/webform_options_limit/src/Controller/WebformOptionsLimitController.php, line 127

Class

WebformOptionsLimitController
Provides route responses for webform options limit.

Namespace

Drupal\webform_options_limit\Controller

Code

protected static function hasOptionsLimit(WebformInterface $webform) {
  $handlers = $webform
    ->getHandlers();
  foreach ($handlers as $handler) {
    if ($handler instanceof WebformOptionsLimitHandlerInterface) {
      $limit_user = $handler
        ->getSetting('limit_user');
      if (empty($limit_user)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}