InvalidLibrariesExtendSpecificationException example

protected function applyLibrariesExtend($extension$library_name$library_definition) {
    $libraries_extend = $this->themeManager->getActiveTheme()->getLibrariesExtend();
    if (!empty($libraries_extend["$extension/$library_name"])) {
      foreach ($libraries_extend["$extension/$library_name"] as $library_extend_name) {
        if (isset($library_definition['deprecated'])) {
          $extend_message = sprintf('Theme "%s" is extending a deprecated library.', $extension);
          $library_deprecation = str_replace('%library_id%', "$extension/$library_name", $library_definition['deprecated']);
          @trigger_error("$extend_message $library_deprecation", E_USER_DEPRECATED);
        }
        if (!is_string($library_extend_name)) {
          // Only string library names are allowed.           throw new InvalidLibrariesExtendSpecificationException('The libraries-extend specification for each library must be a list of strings.');
        }
        [$new_extension$new_library_name] = explode('/', $library_extend_name, 2);
        $new_libraries = $this->get($new_extension);
        if (isset($new_libraries[$new_library_name])) {
          $library_definition = NestedArray::mergeDeep($library_definition$new_libraries[$new_library_name]);
        }
        else {
          throw new InvalidLibrariesExtendSpecificationException(sprintf('The specified library "%s" does not exist.', $library_extend_name));
        }
      }
    }
    
Home | Imprint | This part of the site doesn't use cookies.