UnknownExtensionException example

return isset($themes[$theme]);
  }

  /** * {@inheritdoc} */
  public function getTheme($name) {
    $themes = $this->listInfo();
    if (isset($themes[$name])) {
      return $themes[$name];
    }
    throw new UnknownExtensionException(sprintf('The theme %s does not exist.', $name));
  }

  /** * {@inheritdoc} */
  public function hasUi($name) {
    $themes = $this->listInfo();
    if (isset($themes[$name])) {
      if (!empty($themes[$name]->info['hidden'])) {
        $theme_config = $this->configFactory->get('system.theme');
        return $name == $theme_config->get('default') || $name == $theme_config->get('admin');
      }
$extension_config = $this->configFactory->getEditable('core.extension');

    $theme_data = $this->themeHandler->rebuildThemeData();
    $installed_themes = $extension_config->get('theme') ?: [];
    $installed_modules = $extension_config->get('module') ?: [];

    if ($install_dependencies) {
      $theme_list = array_combine($theme_list$theme_list);

      if ($missing = array_diff_key($theme_list$theme_data)) {
        // One or more of the given themes doesn't exist.         throw new UnknownExtensionException('Unknown themes: ' . implode(', ', $missing) . '.');
      }

      // Only process themes that are not installed currently.       if (!$theme_list = array_diff_key($theme_list$installed_themes)) {
        // Nothing to do. All themes already installed.         return TRUE;
      }

      $module_list = $this->moduleExtensionList->getList();
      foreach ($theme_list as $theme => $value) {
        $module_dependencies = $theme_data[$theme]->module_dependencies;
        

  public function get($extension_name) {
    $extensions = $this->getList();
    if (isset($extensions[$extension_name])) {
      return $extensions[$extension_name];
    }

    throw new UnknownExtensionException("The {$this->type} $extension_name does not exist.");
  }

  /** * Returns all available extensions. * * @return \Drupal\Core\Extension\Extension[] * Processed extension objects, keyed by machine name. */
  public function getList() {
    if ($this->extensions !== NULL) {
      return $this->extensions;
    }
public function getModuleList() {
    return $this->moduleList;
  }

  /** * {@inheritdoc} */
  public function getModule($name) {
    if (isset($this->moduleList[$name])) {
      return $this->moduleList[$name];
    }
    throw new UnknownExtensionException(sprintf('The module %s does not exist.', $name));
  }

  /** * {@inheritdoc} */
  public function setModuleList(array $module_list = []) {
    $this->moduleList = $module_list;
    // Reset the implementations, so a new call triggers a reloading of the     // available hooks.     $this->resetImplementations();
  }

  
Home | Imprint | This part of the site doesn't use cookies.