• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 1c8823bb88eba68c9cbef16b055532919ae404da

10 Apr 2024 09:56AM UTC coverage: 52.21%. First build
1c8823bb88eba68c9cbef16b055532919ae404da

push

github

vraja-pro
Merge branch '21141-decouple-hidden-fields-for-metabox' into feature/decouple-hidden-fields

7513 of 13830 branches covered (54.32%)

Branch coverage included in aggregate %.

5 of 16 new or added lines in 10 files covered. (31.25%)

28357 of 54873 relevant lines covered (51.68%)

40910.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/presenters/admin/meta-fields-presenter.php
1
<?php
2

3
namespace Yoast\WP\SEO\Presenters\Admin;
4

5
use WP_Post;
6
use WPSEO_Meta;
7
use Yoast\WP\SEO\Presenters\Abstract_Presenter;
8

9
/**
10
 * Presenter class for meta fields in the post editor.
11
 *
12
 * Outputs the hidden fields for a particular field group and post.
13
 */
14
class Meta_Fields_Presenter extends Abstract_Presenter {
15

16
        /**
17
         * The meta fields for which we are going to output hidden input.
18
         *
19
         * @var array
20
         */
21
        private $meta_fields;
22

23
        /**
24
         * The metabox post.
25
         *
26
         * @var WP_Post The metabox post.
27
         */
28
        private $post;
29

30
        /**
31
         * Meta_Fields_Presenter constructor.
32
         *
33
         * @param WP_Post $post        The metabox post.
34
         * @param string  $field_group The key under which a group of fields is grouped.
35
         * @param string  $post_type   The post type.
36
         */
37
        public function __construct( $post, $field_group, $post_type = 'post' ) {
×
38
                $this->post        = $post;
×
39
                $this->meta_fields = WPSEO_Meta::get_meta_field_defs( $field_group, $post_type );
×
40
        }
41

42
        /**
43
         * Presents the Meta Fields.
44
         *
45
         * @return string The styled Alert.
46
         */
47
        public function present() {
×
48
                $output = '';
×
49

50
                foreach ( $this->meta_fields as $key => $meta_field ) {
×
NEW
51
                        $form_key = \esc_attr( WPSEO_Meta::$form_prefix . $key );
×
52

NEW
53
                        $output .= '<input type="hidden" id="' . $form_key . '" name="' . $form_key . '"/>' . "\n";
×
54
                }
55

56
                return $output;
×
57
        }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc