/** * @see html::icon() */ public static function icon($options = []) { // if we are rendering image if (isset($options['file'])) { return numbers_frontend_html_class_base::icon($options); } else { if (isset($options['type'])) { library::add('fontawesome'); // generating class & rendering tag $options['class'] = array_add_token($options['class'] ?? [], 'fa fa-' . $options['type'], ' '); if (!empty($options['class_only'])) { return implode(' ', $options['class']); } else { $options['tag'] = $options['tag'] ?? 'i'; return html::tag($options); } } } }
/** * @see html::label2() */ public static function label2($options = []) { $options['tag'] = $options['tag'] ?? 'span'; $options['type'] = 'label-' . ($options['type'] ?? 'primary'); $options['class'] = array_add_token($options['class'] ?? [], [$options['type'], 'label'], ' '); return html::tag($options); }
/** * @see html::icon() */ public static function icon($options = []) { // if we are rendering image if (isset($options['file'])) { $name = $options['file']; if (isset($options['path'])) { $path = $options['path']; } $options['src'] = $path . $name; if (!isset($options['style'])) { $options['style'] = 'vertical-align: middle;'; } array_key_unset($options, ['file', 'path']); // we need to get width and height of the image from the end of filename if (preg_match('/([0-9]+)(x([0-9]+))?./', $name, $matches)) { if (isset($matches[1])) { $options['width'] = $matches[1]; } if (isset($matches[3])) { $options['height'] = $matches[1]; } } return html::img($options); } else { if (isset($options['type'])) { $options['class'] = array_add_token($options['class'] ?? [], 'icon ' . $options['type'], ' '); $options['tag'] = $options['tag'] ?? 'i'; return html::tag($options); } } }
public static function submit($options = []) { $type = $options['type'] ?? ''; $options['class'] = array_add_token($options['class'] ?? [], 'ui button ' . $type, ' '); return parent::submit($options); }