Skip to content
Snippets Groups Projects
Extension.php 676 B
Newer Older
Tobias Zimmermann's avatar
Tobias Zimmermann committed
<?php

namespace Drupal\libraries\Extension;

use Drupal\Core\Extension\Extension as CoreExtension;

/**
 * @todo
 */
class Extension extends CoreExtension implements ExtensionInterface {

  /**
   * {@inheritdoc}
   *
   * @todo Determine whether this needs to be cached.
   */
  public function getLibraryDependencies() {
    // @todo Make this unit-testable.
    $type = $this->getType();
    // system_get_info() lists profiles as type "module"
    $type = $type == 'profile' ? 'module' : $type;
    $info = system_get_info($type, $this->getName());
Tobias Zimmermann's avatar
Tobias Zimmermann committed
    assert('!empty($info)');
    return isset($info['library_dependencies']) ? $info['library_dependencies'] : [];
  }

}