Created
          April 24, 2014 09:27 
        
      - 
      
- 
        Save tristanlins/11248038 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| class Hooks | |
| { | |
| public function outputFrontendTemplate($buffer) | |
| { | |
| $buffer = preg_replace_callback( | |
| '~class="([^"]+)"~', | |
| function ($matches) { | |
| $classes = explode(' ', $matches[1]); | |
| $classes = array_filter($classes); | |
| $index = array_search('invisible', $classes); | |
| if ($index !== false) { | |
| $classes[$index] = 'sr-only'; | |
| } | |
| return sprintf('class="%s"', implode(' ', $classes)); | |
| }, | |
| $buffer | |
| ); | |
| return $buffer; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment