Image.php 859 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace UCore\DcatAdmin\Metrics;
  3. use Dcat\Admin\Widgets\Widget;
  4. class Image extends Widget
  5. {
  6. protected $view = 'admin_core.widgets.image';
  7. public $src = '';
  8. public $height = '100px';
  9. public $width = '100px';
  10. public function __construct($imgSrc, $height = '100px', $width ="100px")
  11. {
  12. $this->src = $imgSrc;
  13. $this->height = $height;
  14. $this->width = $width;
  15. }
  16. public function defaultVariables()
  17. {
  18. return [
  19. 'src' => $this->src,
  20. 'width' => $this->width,
  21. 'height' => $this->height,
  22. 'attributes' => $this->formatHtmlAttributes(),
  23. 'options' => $this->options,
  24. 'class' => $this->getElementClass(),
  25. 'selector' => $this->getElementSelector(),
  26. ];
  27. }
  28. }