Пример #1
0
 /**
  * Get the meta group.
  *
  * @param      $meta_group_id
  * @param bool $is_the_meta
  *
  * @return bool|mixed|void
  */
 function tribe_get_meta_group($meta_group_id, $is_the_meta = false)
 {
     do_action('tribe_get_meta_group', $meta_group_id, $is_the_meta);
     $type = 'meta_group';
     // die silently if the requested meta group is not registered
     if (!Tribe__Events__Meta_Factory::check_exists($meta_group_id, $type)) {
         return false;
     }
     $meta_group = Tribe__Events__Meta_Factory::get_args($meta_group_id, $type);
     $meta_ids = Tribe__Events__Meta_Factory::get_order($meta_group_id);
     $group_html = '';
     // internal check for hiding items in the meta
     if (!$meta_group['show_on_meta']) {
         return false;
     }
     $meta_pos_int = 0;
     $total_meta_items = tribe_count_hierarchical($meta_ids);
     foreach ($meta_ids as $meta_id_group) {
         foreach ($meta_id_group as $meta_id) {
             $meta_pos_int++;
             $group_html = tribe_separated_field($group_html, $meta_group['wrap']['meta_separator'], tribe_get_meta($meta_id, $is_the_meta));
         }
     }
     $params = array($meta_group_id);
     if (!empty($meta['filter_callback'])) {
         return call_user_func_array($meta['filter_callback'], $params);
     }
     if (!empty($meta['callback'])) {
         $value = call_user_func_array($meta['callback'], $params);
     }
     $value = empty($value) ? $group_html : $value;
     $html = !empty($group_html) ? Tribe__Events__Meta_Factory::template($meta_group['label'], $value, $meta_group_id, 'meta_group') : '';
     return apply_filters('tribe_get_meta_group', $html, $meta_group_id);
 }
 /**
  * @dataProvider separated_field_inputs
  */
 public function test_tribe_separated_field($body, $sep, $field, $expected)
 {
     $this->assertEquals($expected, tribe_separated_field($body, $sep, $field));
 }