You are here

protected static function WebformOptionsLimitAccess::hasOptionsLimit in Webform 6.x

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 WebformOptionsLimitAccess::hasOptionsLimit()
WebformOptionsLimitAccess::checkAccess in modules/webform_options_limit/src/Access/WebformOptionsLimitAccess.php
Check whether the webform option limits summary.
WebformOptionsLimitAccess::checkNodeAccess in modules/webform_options_limit/src/Access/WebformOptionsLimitAccess.php
Check whether the user can access a node's webform options limits summary.

File

modules/webform_options_limit/src/Access/WebformOptionsLimitAccess.php, line 76

Class

WebformOptionsLimitAccess
Defines the custom access control handler for the webform options limits.

Namespace

Drupal\webform_options_limit\Access

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;
}