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


PHP cmb2_get_field函数代码示例

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


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

示例1: __construct

 public function __construct($field, \Cmb2Grid\Grid\Cmb2Grid $grid)
 {
     $this->setParentFieldId($field[0]);
     $this->setFieldId($field[1]);
     $field = cmb2_get_field($grid->getCmb2Obj(), $this->getParentFieldId());
     $this->setField($field);
     //parent::__construct( $field, $grid );
     /* $this->setGrid( $grid );
     			  if ( is_string( $field ) ) {
     			  $this->setFieldId( $field );
     			  } elseif ( is_array( $field ) ) {
     			  $this->setFieldId( $field[0] );
     			  }
     			  $fieldId = $this->getFieldId();
     
     
     			  $field = cmb2_get_field( $grid->getCmb2Obj(), $fieldId );
     
     			  $this->setField( $field );
     
     			  if ( is_array( $field ) ) {
     			  if ( isset( $field['class'] ) ) {
     			  $this->setColumnClass( $field['class'] );
     			  }
     			  } */
 }
开发者ID:jrfnl,项目名称:CMB2-grid,代码行数:26,代码来源:GroupColumn.php

示例2: test_cmb2_get_field

 public function test_cmb2_get_field()
 {
     $val_to_save = '123Abc';
     $field_id = 'test_test';
     $retrieved = cmb2_get_field($this->cmb_id, $field_id, $this->post_id);
     $this->assertInstanceOf('CMB2_Field', $retrieved);
 }
开发者ID:gurustump,项目名称:cyclegarden,代码行数:7,代码来源:test-cmb-core.php

示例3: __construct

 public function __construct($field, Cmb2Grid $grid)
 {
     $this->setGrid($grid);
     if (is_string($field)) {
         $this->setFieldId($field);
     } elseif (is_array($field)) {
         $this->setFieldId($field[0]);
     } elseif (is_a($field, '\\Cmb2Grid\\Grid\\Group\\Cmb2GroupGrid')) {
         $this->setFieldId($field->getParentFieldId());
     }
     $fieldId = $this->getFieldId();
     $finalField = cmb2_get_field($grid->getCmb2Obj(), $fieldId);
     $this->setField($finalField);
     if (is_array($field)) {
         if (isset($field['class'])) {
             $this->setColumnClass($field['class']);
         }
     }
 }
开发者ID:jrfnl,项目名称:CMB2-grid,代码行数:19,代码来源:Column.php

示例4: cmb2_get_field_value

/**
 * Get a field's value.
 * @since  1.1.0
 * @param  array  $meta_box    Metabox ID or Metabox config array
 * @param  array  $field_id    Field ID or all field arguments
 * @param  int    $object_id   Object ID
 * @param  string $object_type Type of object being saved. (e.g., post, user, comment, or options-page).
 *                             Defaults to metabox object type.
 * @return mixed               Maybe escaped value
 */
function cmb2_get_field_value($meta_box, $field_id, $object_id = 0, $object_type = '')
{
    $field = cmb2_get_field($meta_box, $field_id, $object_id, $object_type);
    return $field->escaped_value();
}
开发者ID:jrajalu,项目名称:myxon,代码行数:15,代码来源:helper-functions.php

示例5: test_remove_group_field

 public function test_remove_group_field()
 {
     $cmb = cmb2_get_metabox('test2');
     $cmb->remove_field('colorpicker', 'group_field');
     $field = cmb2_get_field('test2', 'group_field', $this->post_id);
     $mock = array('first_field' => array('name' => 'Field 1', 'id' => 'first_field', 'type' => 'text'));
     $this->assertEquals($mock, $field->fields());
 }
开发者ID:Makenrro,项目名称:repos,代码行数:8,代码来源:test-cmb-core.php

示例6: test_field_attributes

    public function test_field_attributes()
    {
        $cmb = new CMB2($this->attributes_test);
        $field = cmb2_get_field($this->attributes_test['id'], 'attributes_test_field', $this->post_id);
        $this->assertInstanceOf('CMB2_Field', $field);
        $expected_field = '
		<div class="cmb-row cmb-type-text cmb2-id-attributes-test-field table-layout">
			<div class="cmb-th"><label for="attributes_test_field">Name</label></div>
			<div class="cmb-td">
				<input type="number" class="regular-text" name="attributes_test_field" id="arbitrary-id" value="" disabled="disabled" data-test=\'{"one":"One","two":"Two","true":true,"false":false,"array":{"nested_data":true}}\'/>
				<p class="cmb2-metabox-description">This is a description</p>
			</div>
		</div>
		';
        $this->assertHTMLstringsAreEqual($expected_field, $this->render_field($field));
    }
开发者ID:Dovahkiin1991,项目名称:CMB2,代码行数:16,代码来源:test-cmb-types.php

示例7: test_remove_group_field

 public function test_remove_group_field()
 {
     $cmb = cmb2_get_metabox('test2');
     $cmb->remove_field('colorpicker', 'group_field');
     $field = cmb2_get_field('test2', 'group_field', $this->post_id);
     $fields = $field->fields();
     $mock_fields = array('first_field' => array('name' => 'Field 1', 'id' => 'first_field', 'type' => 'text'));
     foreach ($mock_fields as $field_id => $field_props_array) {
         foreach ($field_props_array as $prop_name => $prop_value) {
             $this->assertEquals($prop_value, $fields[$field_id][$prop_name]);
         }
     }
 }
开发者ID:Macciato,项目名称:Grain-WP,代码行数:13,代码来源:test-cmb-core.php


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