PHP code example of drupal-composer / drupal-paranoia
1. Go to this page and download the library: Download drupal-composer/drupal-paranoia library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
drupal-composer / drupal-paranoia example snippets
/**
* @file
* Contains \DrupalProject\composer\ScriptHandler.
*/
namespace DrupalProject\composer;
use DrupalComposer\DrupalParanoia\AssetFileTypesEvent;
class ScriptHandler {
public static function setAssetFileTypes(AssetFileTypesEvent $event) {
$asset_file_types = $event->getAssetFileTypes();
// Do what you want with the asset file types.
$event->setAssetFileTypes($asset_file_types);
}
}
namespace MyVendor;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use DrupalComposer\DrupalParanoia\PluginEvents as DrupalParanoiaPluginEvents;
class MyClass implements PluginInterface, EventSubscriberInterface
{
protected $composer;
protected $io;
public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
}
public static function getSubscribedEvents()
{
return array(
DrupalParanoiaPluginEvents::POST_COMMAND_RUN => 'postDrupalParanoiaCommand',
);
}
public function postDrupalParanoiaCommand(CommandEvent $event) {
// Add your custom action.
}
}