v1.php 812 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace zin;
  3. class sqlBuilderHelpIcon extends wg
  4. {
  5. /**
  6. * @var mixed[]
  7. */
  8. protected static $defineProps = array(
  9. 'text?: string',
  10. 'placement?: string="right"',
  11. 'toggle?: bool=true'
  12. );
  13. protected function build()
  14. {
  15. list($text, $placement, $toggle) = $this->prop(array('text', 'placement', 'toggle'));
  16. if(empty($text)) return span(setClass('text-warning'), icon('help'));
  17. return btn
  18. (
  19. setClass('inline ghost'),
  20. set::size('sm'),
  21. setData(array('title' => $text, 'placement' => $placement, 'className' => 'text-gray border border-light', 'type' => 'white', 'hideOthers' => true)),
  22. $toggle ? set('data-toggle', 'tooltip') : null,
  23. icon('help')
  24. );
  25. }
  26. }