Checks if the breakpoint group is valid.
true Returns true if the breakpoint group is valid.
Drupal\breakpoint\InvalidBreakpointSourceTypeException
Drupal\breakpoint\InvalidBreakpointSourceException
public function isValid() {
// Check for illegal values in breakpoint group source type.
if (!in_array($this->sourceType, array(
Breakpoint::SOURCE_TYPE_USER_DEFINED,
Breakpoint::SOURCE_TYPE_MODULE,
Breakpoint::SOURCE_TYPE_THEME,
))) {
throw new InvalidBreakpointSourceTypeException(format_string('Invalid source type @source_type', array(
'@source_type' => $this->sourceType,
)));
}
// Check for illegal characters in breakpoint group source.
if (preg_match('/[^a-z_]+/', $this->source) || empty($this->source)) {
throw new InvalidBreakpointSourceException(format_string("Invalid value '@source' for breakpoint group source property. Breakpoint group source property can only contain lowercase letters and underscores.", array(
'@source' => $this->source,
)));
}
// Check for illegal characters in breakpoint group name.
if (preg_match('/[^a-z0-9_]+/', $this->name || empty($this->name))) {
throw new InvalidBreakpointNameException(format_string("Invalid value '@name' for breakpoint group name property. Breakpoint group name property can only contain lowercase letters, numbers and underscores.", array(
'@name' => $this->name,
)));
}
return TRUE;
}