本文整理汇总了PHP中RWMB_Field::get_value方法的典型用法代码示例。如果您正苦于以下问题:PHP RWMB_Field::get_value方法的具体用法?PHP RWMB_Field::get_value怎么用?PHP RWMB_Field::get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RWMB_Field
的用法示例。
在下文中一共展示了RWMB_Field::get_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_value
/**
* Get the field value. Return meaningful info of the files.
*
* @param array $field Field parameters
* @param array $args Not used for this field
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return mixed Full info of uploaded files
*/
public static function get_value($field, $args = array(), $post_id = null)
{
$value = parent::get_value($field, $args, $post_id);
if (!$field['clone']) {
$value = self::call('files_info', $field, $value, $args);
} else {
$return = array();
foreach ($value as $subvalue) {
$return[] = self::call('files_info', $field, $subvalue, $args);
}
$value = $return;
}
if (isset($args['limit'])) {
$value = array_slice($value, 0, intval($args['limit']));
}
return $value;
}
示例2: array
/**
* Get the field value
* The difference between this function and 'meta' function is 'meta' function always returns the escaped value
* of the field saved in the database, while this function returns more meaningful value of the field
*
* @param array $field Field parameters
* @param array $args Not used for this field
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return mixed Array(latitude, longitude, zoom)
*/
static function get_value($field, $args = array(), $post_id = null)
{
$value = parent::get_value($field, $args, $post_id);
list($latitude, $longitude, $zoom) = explode(',', $value . ',,');
return compact('latitude', 'longitude', 'zoom');
}
示例3: array
/**
* Output the field value
* Display option name instead of option value
*
* @use self::meta()
*
* @param array $field Field parameters
* @param array $args Additional arguments. Rarely used. See specific fields for details
* @param int|null $post_id Post ID. null for current post. Optional.
*
* @return mixed Field value
*/
static function the_value($field, $args = array(), $post_id = null)
{
$value = parent::get_value($field, $args, $post_id);
return empty($value) ? '' : $field['options'][$value];
}