public static function confirm_a($href = '', $title = 'Are you sure?', $extra = []) { if (is_array($href)) { $href['class'] .= ' js-o_dialog'; $href['href'] = $href['href'] ? $href['href'] : '#'; echo '<a ' . o::convert2attributes($href) . '>'; } else { $defaults = ['icon' => 'exclamation-triangle']; $extra = array_merge($defaults, $extra); $extra['heading'] = $title; $class = $extra['class']; unset($extra['class']); echo '<a href="' . $href . '" class="js-o_dialog ' . $class . '" ' . o::convert2data($extra) . '>'; } }
public static function table_action($icon, $url, $extra = []) { $defaults = ['handler' => 'js-' . $icon, 'icon_extra' => '', 'class' => '', 'data' => []]; extract(array_diff_key($defaults, $extra) + array_intersect_key($extra, $defaults)); echo self::table_action_link($url, $class . ' ' . $handler, $icon, $icon_extra, o::convert2data($data)); }