PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / admin / metabox / class-metabox-collapsible.php

class-metabox-collapsible.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at admin/metabox/class-metabox-collapsible.php

85 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 */
7
8 /**
9 * Generates the HTML for a metabox tab.
10 */
11 class WPSEO_Metabox_Collapsible implements WPSEO_Metabox_Tab {
12
13 /**
14 * The collapsible's unique identifier.
15 *
16 * @var string
17 */
18 private $name;
19
20 /**
21 * The content to be displayed inside the collapsible.
22 *
23 * @var string
24 */
25 private $content;
26
27 /**
28 * The label.
29 *
30 * @var string
31 */
32 private $link_content;
33
34 /**
35 * Constructor.
36 *
37 * @param string $name The name of the tab, used as an identifier in the html.
38 * @param string $content The tab content.
39 * @param string $link_content The text content of the tab link.
40 */
41 public function __construct( $name, $content, $link_content ) {
42 $this->name = $name;
43 $this->content = $content;
44 $this->link_content = $link_content;
45 }
46
47 /**
48 * Returns the html for the tab link.
49 *
50 * @return string
51 */
52 public function link() {
53 return $this->link_content;
54 }
55
56 /**
57 * Returns the html for the tab content.
58 *
59 * @return string
60 */
61 public function content() {
62 $collapsible_paper = new WPSEO_Paper_Presenter(
63 $this->link(),
64 null,
65 [
66 'content' => $this->content,
67 'collapsible' => true,
68 'class' => 'metabox wpseo-form wpseo-collapsible-container',
69 'paper_id' => 'collapsible-' . $this->name,
70 ],
71 );
72
73 return $collapsible_paper->get_output();
74 }
75
76 /**
77 * Returns the collapsible's unique identifier.
78 *
79 * @return string
80 */
81 public function get_name() {
82 return $this->name;
83 }
84 }
85