You are here

public function DateRecurPartGrid::isFrequencyAllowed in Recurring Dates Field 3.1.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurPartGrid.php \Drupal\date_recur\DateRecurPartGrid::isFrequencyAllowed()
  2. 3.x src/DateRecurPartGrid.php \Drupal\date_recur\DateRecurPartGrid::isFrequencyAllowed()
  3. 3.0.x src/DateRecurPartGrid.php \Drupal\date_recur\DateRecurPartGrid::isFrequencyAllowed()

Determines whether a frequency and at least one part is supported.

Parameters

string $frequency: A frequency.

Return value

bool Whether a frequency is supported.

File

src/DateRecurPartGrid.php, line 52

Class

DateRecurPartGrid
Frequency/part support grid.

Namespace

Drupal\date_recur

Code

public function isFrequencyAllowed(string $frequency) : bool {
  assert(in_array($frequency, DateRecurRruleMap::FREQUENCIES, TRUE));
  if ($this
    ->isAllowEverything()) {
    return TRUE;
  }
  return isset($this->allowedParts[$frequency]) && count($this->allowedParts[$frequency]) > 0;
}