| 1 |
<?php |
| 2 |
/** |
| 3 |
* Logs Meta Boxes |
| 4 |
* |
| 5 |
* @package GamiPress\Admin\Meta_Boxes\Logs |
| 6 |
* @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com> |
| 7 |
* @since 1.4.7 |
| 8 |
*/ |
| 9 |
// Exit if accessed directly |
| 10 |
if( !defined( 'ABSPATH' ) ) exit; |
| 11 |
|
| 12 |
/** |
| 13 |
* Register requirements meta boxes |
| 14 |
* |
| 15 |
* @since 1.0.0 |
| 16 |
*/ |
| 17 |
function gamipress_logs_meta_boxes() { |
| 18 |
|
| 19 |
// Start with an underscore to hide fields from custom fields list |
| 20 |
$prefix = '_gamipress_'; |
| 21 |
|
| 22 |
// Title |
| 23 |
gamipress_add_meta_box( |
| 24 |
'gamipress-log-title', |
| 25 |
__( 'Title', 'gamipress' ), |
| 26 |
'gamipress_logs', |
| 27 |
array( |
| 28 |
'title' => array( |
| 29 |
'name' => __( 'Title', 'gamipress' ), |
| 30 |
'type' => 'text', |
| 31 |
'attributes' => array( |
| 32 |
'placeholder' => __( 'Enter title here. Leave empty if you want to generate it from the pattern.', 'gamipress' ), |
| 33 |
) |
| 34 |
), |
| 35 |
), |
| 36 |
array( |
| 37 |
'priority' => 'high', |
| 38 |
) |
| 39 |
); |
| 40 |
|
| 41 |
// Log Data |
| 42 |
gamipress_add_meta_box( |
| 43 |
'log-data', |
| 44 |
__( 'Log Data', 'gamipress' ), |
| 45 |
'gamipress_logs', |
| 46 |
array( |
| 47 |
'user_id' => array( |
| 48 |
'name' => __( 'User', 'gamipress' ), |
| 49 |
'tooltip' => __( 'User assigned to this log.', 'gamipress' ), |
| 50 |
'label_cb' => 'cmb_tooltip_label_cb', |
| 51 |
'type' => 'select', |
| 52 |
'options_cb' => 'gamipress_options_cb_users' |
| 53 |
), |
| 54 |
'type' => array( |
| 55 |
'name' => __( 'Type', 'gamipress' ), |
| 56 |
'tooltip' => __( 'The log type.', 'gamipress' ), |
| 57 |
'label_cb' => 'cmb_tooltip_label_cb', |
| 58 |
'type' => 'select', |
| 59 |
'options' => gamipress_get_log_types(), |
| 60 |
), |
| 61 |
$prefix . 'pattern' => array( |
| 62 |
'name' => __( 'Pattern', 'gamipress' ), |
| 63 |
'tooltip' => __( 'The log output pattern.', 'gamipress' ), |
| 64 |
'label_cb' => 'cmb_tooltip_label_cb', |
| 65 |
'desc' => __( 'Available tags:', 'gamipress' ) . gamipress_get_log_pattern_tags_html(), |
| 66 |
'type' => 'text', |
| 67 |
), |
| 68 |
), |
| 69 |
array( 'priority' => 'high' ) |
| 70 |
); |
| 71 |
|
| 72 |
} |
| 73 |
add_action( 'gamipress_init_gamipress_logs_meta_boxes', 'gamipress_logs_meta_boxes' ); |