Skip to content

Commit

Permalink
Issue #2643888 by Devin Carlson: Remove dependency on Composer Manage…
Browse files Browse the repository at this point in the history
…r in favour of implementing hook_requirements().
  • Loading branch information
DevinCarlson authored and slashrsm committed Jan 5, 2016
1 parent 755b685 commit a618650
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 0 additions & 1 deletion url_embed.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description: 'Allows URLs to be embedded using a text editor.'
core: 8.x
package: Filters
dependencies:
- composer_manager
- editor
- embed
- filter
20 changes: 20 additions & 0 deletions url_embed.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
use Drupal\embed\Entity\EmbedButton;
use Drupal\Core\Utility\UpdateException;

/**
* Implements hook_requirements().
*
* Checks that the necessary libraries have been installed.
*/
function url_embed_requirements($phase) {
$requirements = [];

if ($phase === 'install') {
if (!class_exists('\Embed\Embed')) {
$requirements['url_embed_library'] = [
'description' => t("URL Embed requires the Embed/Embed library."),
'severity' => REQUIREMENT_ERROR,
];
}
}

return $requirements;
}

/**
* Convert URL embed buttons to embed buttons.
*
Expand Down

0 comments on commit a618650

Please sign in to comment.