PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.3
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.3
8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 7.8.6 All 45 releases
← All changes | libraries/display-field-type.php +38 -0 7.9.28.0.3 View file →
@@ -1,0 +1,38 @@
1 +<?php
2 +/**
3 + * CMB2 Display Field Type
4 + */
5 +
6 +if( ! function_exists( 'cmb2_render_display' ) ) :
7 +
8 + /**
9 + * Render a text-only field type
10 + *
11 + * @param array $field The field data array
12 + * @param mixed $value The stored value for this field
13 + * @param integer|string $object_id The object ID
14 + * @param string $object_type The object type
15 + * @param CMB2_Types $field_type The field type object
16 + *
17 + * @return string HTML markup for our field
18 + */
19 + function cmb2_render_display( $field, $value, $object_id, $object_type, $field_type ) {
20 +
21 + $value = isset( $field->args['value'] ) ? $field->args['value'] : $value;
22 +
23 + // Parse args
24 + $attrs = $field_type->parse_args( 'display', array(
25 + 'class' => $field->args['classes'],
26 + 'name' => $field_type->_name(),
27 + 'id' => $field_type->_id(),
28 + ) );
29 +
30 + echo sprintf( '<span%s>%s</span>%s',
31 + $field_type->concat_attrs( $attrs ),
32 + $value,
33 + $field_type->_desc( true )
34 + );
35 + }
36 + add_action( 'cmb2_render_display', 'cmb2_render_display', 10, 5 );
37 +
38 +endif;