Package.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @package Grav\Common\GPM
  4. *
  5. * @copyright Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Common\GPM\Local;
  9. use Grav\Common\Data\Data;
  10. use Grav\Common\GPM\Common\Package as BasePackage;
  11. class Package extends BasePackage
  12. {
  13. protected $settings;
  14. public function __construct(Data $package, $package_type = null)
  15. {
  16. $data = new Data($package->blueprints()->toArray());
  17. parent::__construct($data, $package_type);
  18. $this->settings = $package->toArray();
  19. $html_description = \Parsedown::instance()->line($this->__get('description'));
  20. $this->data->set('slug', $package->__get('slug'));
  21. $this->data->set('description_html', $html_description);
  22. $this->data->set('description_plain', strip_tags($html_description));
  23. $this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->__get('slug')));
  24. }
  25. /**
  26. * @return mixed
  27. */
  28. public function isEnabled()
  29. {
  30. return $this->settings['enabled'];
  31. }
  32. }