customfields.php 606 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Plugins\Customfields;
  3. use Typemill\Plugin;
  4. class Customfields extends Plugin
  5. {
  6. public static function getSubscribedEvents()
  7. {
  8. return array(
  9. 'onTwigLoaded' => 'onTwigLoaded',
  10. 'onMetaLoaded' => 'onMetaLoaded'
  11. );
  12. }
  13. public function onTwigLoaded()
  14. {
  15. $this->addEditorJS('/customfields/js/customfields.js');
  16. }
  17. public function onMetaLoaded($meta)
  18. {
  19. $meta = $meta->getData();
  20. # do something with the fields:
  21. $myTabInformation = $meta['mytab'];
  22. }
  23. }