private function isValidRequiredH5pData($h5pData, $requirements, $library_name) {
    $valid = TRUE;
    foreach ($requirements as $required => $requirement) {
      if (is_int($required)) {
        // We have an array of allowed options
        return $this->isValidH5pDataOptions($h5pData, $requirements, $library_name);
      }
      if (isset($h5pData[$required])) {
        $valid = $this->isValidRequirement($h5pData[$required], $requirement, $library_name, $required) && $valid;
      }
      else {
        $this->h5pF->setErrorMessage($this->h5pF->t('The required property %property is missing from %library', array('%property' => $required, '%library' => $library_name)), 'missing-required-property');
        $valid = FALSE;
      }
    }
    return $valid;
  }
private function isValidRequiredH5pData($h5pData, $requirements, $library_name) {
    $valid = TRUE;
    foreach ($requirements as $required => $requirement) {
      if (is_int($required)) {
        // We have an array of allowed options
        return $this->isValidH5pDataOptions($h5pData, $requirements, $library_name);
      }
      if (isset($h5pData[$required])) {
        $valid = $this->isValidRequirement($h5pData[$required], $requirement, $library_name, $required) && $valid;
      }
      else {
        $this->h5pF->setErrorMessage($this->h5pF->t('The required property %property is missing from %library', array('%property' => $required, '%library' => $library_name)), 'missing-required-property');
        $valid = FALSE;
      }
    }
    return $valid;
  }
private function isValidRequiredH5pData ( $ h5pData , $ requirements , $ library_name ) { $ valid = TRUE ; foreach ( $ requirements as $ required => $ requirement ) { if ( is_int ( $ required ) ) { // We have an array of allowed options return $ this -> isValidH5pDataOptions ( $ h5pData , $ requirements , $ library_name ) ; } if ( isset ( $ h5pData [ $ required ] ) ) { $ valid = $ this -> isValidRequirement ( $ h5pData [ $ required ] , $ requirement , $ library_name , $ required ) && $ valid ; } else { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( 'The required property %property is missing from %library' , array ( '%property' => $ required , '%library' => $ library_name ) ) , 'missing-required-property' ) ; $ valid = FALSE ; } } return $ valid ; }
Validates the required h5p data in libraray.json and h5p.json

@param mixed $h5pData
Data to be validated
@param array $requirements
Array with regexp to validate the data against
@param string $library_name
Name of the library we are validating (used in error messages)
@return boolean
TRUE if all the required data exists and is valid, FALSE otherwise
Validates the required h5p data in libraray . json and h5p . json