1

When creating a library, I noticed there is an attribute remote that can be added. I cannot really find any good documentation as to what it is for nor does it seem like it is required.

Questions:

  1. What is the purpose of this remote when defining a library?
  2. How can we be sure the value we add is correct?

Example from https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module:

font-awesome:
  remote: https://fortawesome.github.io/Font-Awesome/
  version: 4.5.0
  license:
    name: MIT
    url: https://fortawesome.github.io/Font-Awesome/license/
    gpl-compatible: true
  css:
    theme:
      https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css: { type: external, minified: true }
1

According to the code/comments in LibraryDiscoveryParser::buildByExtension, it's to help ensure licensing info is included for 3rd party libraries:

// If this is a 3rd party library, the license info is required.
if (isset($library['remote']) && !isset($library['license'])) {
  throw new LibraryDefinitionMissingLicenseException(sprintf("Missing license information in library definition for definition '%s' extension '%s': it has a remote, but no license.", $id, $extension));
}

It's also mentioned in the library docs, but it just says that it's a good idea to include the remote info, not why. It doesn't appear to be used in the code other than the licensing, so I think it's safe to assume it's a reference/info value for now. There is no incorrect value to-to-speak, but it would make sense to set it to the URL of the project you're referencing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.