Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow add collections at runtime #88

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

thestanislav
Copy link
Contributor

Example:

<?php                                                                                                                  
public function onBootstrap(MvcEvent $e){                                                                              
    if ($e->getRequest() instanceof HttpRequest){                                                                      
        $sm = $e->getApplication()->getServiceManager();                                                               
        $sm->get('AsseticBundle\Service')->getEventManager()->attach('setupRenderer', array($this, 'configureAssets'));
    }                                                                                                                  
}                                                                                                                      
<?php                                                                                                                  
public function configureAssets(EventInterface $e){                                                                    
     $response = array();                                                                                              
     /** @var \AsseticBundle\Service $target */                                                                        
     $target = $e->getTarget();                                                                                        
     $config = $target->getServiceLocator()->get('config');                                                            
     $config = $config['collections'];                                                                                 
     foreach($config as $assetName){                                                                                   
         if ($target->getAssetManager()->has($assetName)){                                                             
             $response[] = $assetName;                                                                                 
         }                                                                                                             
     }                                                                                                                 
     return $response;                                                                                                 
}                                                                                                                      

widmogrod and others added 3 commits July 3, 2013 12:24
…ategy::process() must be compatible with Assetic\Factory\Worker\WorkerInterface::process(Assetic\Asset\AssetInterface )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants