コード例 #1
0
 protected function create_shortcode_button($shortcode)
 {
     $class = "";
     if (!empty($shortcode['posttype']) && $shortcode['posttype'][0] != AviaHelper::backend_post_type()) {
         $shortcode['tooltip'] = $shortcode['posttype'][1];
         $class .= "av-shortcode-disabled ";
     }
     $icon = isset($shortcode['icon']) ? '<img src="' . $shortcode['icon'] . '" alt="' . $shortcode['name'] . '" />' : "";
     $data = !empty($shortcode['tooltip']) ? " data-avia-tooltip='" . $shortcode['tooltip'] . "' " : "";
     $data .= !empty($shortcode['drag-level']) ? " data-dragdrop-level='" . $shortcode['drag-level'] . "' " : "";
     $class .= isset($shortcode['class']) ? $shortcode['class'] : "";
     $class .= !empty($shortcode['target']) ? " " . $shortcode['target'] : "";
     $link = "";
     $link .= "<a {$data} href='#" . $shortcode['php_class'] . "' class='shortcode_insert_button " . $class . "' >" . $icon . '<span>' . $shortcode['name'] . "</span></a>";
     return $link;
 }