当前位置: 首页>>代码示例>>PHP>>正文


PHP cmb_print_metabox函数代码示例

本文整理汇总了PHP中cmb_print_metabox函数的典型用法代码示例。如果您正苦于以下问题:PHP cmb_print_metabox函数的具体用法?PHP cmb_print_metabox怎么用?PHP cmb_print_metabox使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cmb_print_metabox函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_form

 /**
  * Displays form markup
  * @since  0.1.3
  * @param  int  $term_id Term ID
  */
 public function display_form($term_id)
 {
     if (!class_exists('cmb_Meta_Box')) {
         return;
     }
     $this->do_override_filters($term_id);
     // Fill in the mb defaults
     $meta_box = cmb_Meta_Box::set_mb_defaults($this->fields());
     // Make sure that our object type is explicitly set by the metabox config
     cmb_Meta_Box::set_object_type(cmb_Meta_Box::set_mb_type($meta_box));
     // Add object id to the form for easy access
     printf('<input type="hidden" name="term_opt_name" value="%s">', $this->id($term_id));
     // Show cmb form
     cmb_print_metabox($meta_box, $this->id($term_id));
 }
开发者ID:ryscript,项目名称:Scinttek-Decade-Project,代码行数:20,代码来源:Taxonomy_MetaData_CMB.php

示例2: cmb_metabox_form

/**
 * Display a metabox form & save it on submission
 * @since  1.0.0
 * @param  array   $meta_box  Metabox config array
 * @param  int     $object_id Object ID
 * @param  boolean $return    Whether to return or echo form
 * @return string             CMB html form markup
 */
function cmb_metabox_form($meta_box, $object_id, $echo = true)
{
    $meta_box = cmb_Meta_Box::set_mb_defaults($meta_box);
    // Make sure form should be shown
    if (!apply_filters('cmb_show_on', true, $meta_box)) {
        return '';
    }
    // Make sure that our object type is explicitly set by the metabox config
    cmb_Meta_Box::set_object_type(cmb_Meta_Box::set_mb_type($meta_box));
    // Save the metabox if it's been submitted
    // check permissions
    // @todo more hardening?
    if (isset($_POST['submit-cmb'], $_POST['object_id'], $_POST['wp_meta_box_nonce']) && wp_verify_nonce($_POST['wp_meta_box_nonce'], cmb_Meta_Box::nonce()) && $_POST['object_id'] == $object_id) {
        cmb_save_metabox_fields($meta_box, $object_id);
    }
    // Show specific metabox form
    // Get cmb form
    ob_start();
    cmb_print_metabox($meta_box, $object_id);
    $form = ob_get_contents();
    ob_end_clean();
    $form_format = apply_filters('cmb_frontend_form_format', '<form class="cmb-form" method="post" id="%s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%s">%s<input type="submit" name="submit-cmb" value="%s" class="button-primary"></form>', $object_id, $meta_box, $form);
    $form = sprintf($form_format, $meta_box['id'], $object_id, $form, __('Save'));
    if ($echo) {
        echo $form;
    }
    return $form;
}
开发者ID:Inteleck,项目名称:hwc,代码行数:36,代码来源:init.php


注:本文中的cmb_print_metabox函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。