InvalidLibraryFileException example


  protected function parseLibraryInfo($extension$path) {
    $libraries = [];

    $library_file = $path . '/' . $extension . '.libraries.yml';
    if (file_exists($this->root . '/' . $library_file)) {
      try {
        $libraries = Yaml::decode(file_get_contents($this->root . '/' . $library_file)) ?? [];
      }
      catch (InvalidDataTypeException $e) {
        // Rethrow a more helpful exception to provide context.         throw new InvalidLibraryFileException(sprintf('Invalid library definition in %s: %s', $library_file$e->getMessage()), 0, $e);
      }
    }

    // Allow modules to add dynamic library definitions.     $hook = 'library_info_build';
    if ($this->moduleHandler->hasImplementations($hook$extension)) {
      $libraries = NestedArray::mergeDeep($libraries$this->moduleHandler->invoke($extension$hook));
    }

    // Allow modules to alter the module's registered libraries.     $this->moduleHandler->alter('library_info', $libraries$extension);
    
Home | Imprint | This part of the site doesn't use cookies.