add check to prevent usage when using sundown

This commit is contained in:
Luis Cordova 2012-10-12 14:18:11 -05:00
parent 21e026f8b2
commit 52f68ec920

View file

@ -3,6 +3,7 @@
namespace Knp\Bundle\MarkdownBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
@ -30,5 +31,9 @@ class KnpMarkdownExtension extends Extension
$container->setParameter('markdown.sundown.extensions', $config['sundown']['extensions']);
$container->setParameter('markdown.sundown.render_flags', $config['sundown']['render_flags']);
$container->setAlias('markdown.parser', $config['parser']['service']);
if ($config['parser']['service'] == 'markdown.parser.sundown' && !class_exists('Sundown\Markdown')) {
throw new InvalidConfigurationException('<strong>Sundown</strong> extension not installed or configured.');
}
}
}