You are here

function composer_manager_vendor_dir in Composer Manager 7.2

Same name and namespace in other branches
  1. 6.2 composer_manager.module \composer_manager_vendor_dir()
  2. 6 composer_manager.module \composer_manager_vendor_dir()
  3. 7 composer_manager.module \composer_manager_vendor_dir()

Returns the path to the vendor directory.

Return value

string

6 calls to composer_manager_vendor_dir()
composer_manager_installed_packages_load in ./composer_manager.admin.inc
Loads the composer.lock file if it exists.
composer_manager_register_autoloader in ./composer_manager.module
Registers the autoloader for all third-party packages.
composer_manager_relative_json_property in ./composer_manager.writer.inc
Helper function for converting value into a relative path.
composer_manager_relative_vendor_dir in ./composer_manager.writer.inc
Returns the vendor directory relative to the composer file directory.
composer_manager_requirements in ./composer_manager.install
Implements hook_requirements().

... See full list

2 string references to 'composer_manager_vendor_dir'
composer_manager_settings_form in ./composer_manager.admin.inc
Administrative settings for the Composer Manager module.
composer_manager_uninstall in ./composer_manager.install
Implements hook_uninstall().

File

./composer_manager.module, line 223
Provides consolidated management of third-party Composer-compatible packages required by contributed modules.

Code

function composer_manager_vendor_dir() {

  // This function is run early in bootstrap, via composer_manager_boot(), so
  // required files need to be included explicitly.
  require_once DRUPAL_ROOT . '/includes/file.inc';
  $vendor_dir = variable_get('composer_manager_vendor_dir', 'sites/all/vendor');
  if (!file_exists($vendor_dir)) {
    require_once __DIR__ . '/composer_manager.writer.inc';
    composer_manager_prepare_directory($vendor_dir);
  }

  // Because this function is run early in bootstrap, use realpath() instead of
  // drupal_realpath().
  if (!($realpath = realpath($vendor_dir))) {
    throw new \RuntimeException(t('Error resolving vendor directory: @dir', array(
      '@dir' => $vendor_dir,
    )));
  }
  return $realpath;
}