HelperDataPlugin.php 863 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. namespace Magefan\Blog\Plugin\Plumrocket\Amp;
  9. /**
  10. * Plugin for helper data (amp extension by Plumrocket)
  11. */
  12. class HelperDataPlugin
  13. {
  14. /**
  15. * Add magefan blog actions to allowed list
  16. * @param \Plumrocket\Amp\Helper\Data $helper
  17. * @param array $allowedPages
  18. * @return array
  19. */
  20. public function afterGetAllowedPages(\Plumrocket\Amp\Helper\Data $helper, $allowedPages)
  21. {
  22. foreach ($allowedPages as &$value) {
  23. if (strpos($value, 'magefan_blog_') === 0) {
  24. $value = str_replace('magefan_blog_', 'blog_', $value);
  25. }
  26. }
  27. return $allowedPages;
  28. }
  29. }