Problem/Motivation

Composer is a great way to provide PHP dependencies. A lot of progress has been made recently in D8 to let contrib modules list dependencies via composer. See #2372815: [meta] Make the <root>/composer.json file a working example. If possible, it would be nice to use composer, rather than Libraries API module to pull in htmlpurifier. Since commerce is already doing this, let's do that in a similar fasion.

Proposed resolution

Remove dependencies on libraries module and replace with a hard dependency on composer_manager. Then build the logic to pull in htmlpurifier via composer. Later on we can make the dependency on composer_manager a soft one if D8 gets even better support for composer.

Remaining tasks

  • Add dependency on composer_manager.
  • Remove dependency on libraries.
  • Build the logic to pull in htmlpurifier via composer.
  • Adjust hook_requirements() accordingly.

User interface changes

n/a

API changes

n/a

Comments

heddn’s picture

Issue summary: View changes
heddn’s picture

Commerce 8.x is depending on https://www.drupal.org/project/composer_manager, rather than using libraries. The only thing is that css/js gets tricky. You have to just guess where it exits. See http://webmozarts.com/2014/12/03/puli-powerful-resource-management-for-php.

If it becomes too much of an issue, we might need to copy in the appropriate css into the D8 module to style the configuration form.

heddn’s picture

Title: Investigate and introduce Composer support » Introduce Composer support
Issue summary: View changes
heddn’s picture

heddn’s picture

Issue tags: +SprintWeekend2015
heddn’s picture

Added first attempt at support into https://github.com/heddn/htmlpurifier

heddn’s picture

NOTE: As of the commit in #6, the process to pull in the upstream library has changed from using libraries to composer_manager. The steps to pull in the library using composer are listed in this blog: https://drupalcommerce.org/blog/31782/managing-d8-module-dependencies-ne...

The new flow becomes:

  1. Install Composer Manager, and initialize it using the init.sh script (or drush composer-manager-init).
  2. This registers the module's Composer command for Drupal core.
  3. Download the desired modules (such as Commerce).
  4. Inside your core/ directory run composer drupal-update.
  5. This rebuilds core/composer.json and downloads the new dependencies.
  6. Install the modules.
naveenvalecha’s picture

Can we only add the composer.json in the module and remove the hard dependency of the Composer Manager same as drupal module upgrador do ?

naveenvalecha’s picture

Assigned: Unassigned » naveenvalecha
Status: Active » Needs review

Correction with #6 https://github.com/heddn/htmlpurifier/pull/6
Needs Work as per #7

naveenvalecha’s picture

Assigned: naveenvalecha » Unassigned
Status: Needs review » Fixed

The PR has been merged and code has been pushed on the d.o. as well. Marking this as fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.