API / Minn\Widgets

Minn\Widgets

3 classes, 22 public methods and 8 internals. This page is the public surface; each class name opens the whole class.

TextWidgets final class

public/minn/src/Minn/Widgets/TextWidgets.php · 161 lines · Open the class →

The text and custom HTML widgets' behaviour (WP_Widget_Text, WP_Widget_Custom_HTML; probes widget-methods, nav-pomo-rest-doubts): which text instances are legacy ones the visual editor would change, how an update settles the filter and visual flags, and the two widgets' output, their filters run with no global post and a gallery inside belonging to no post.

staticisLegacy(mixed $instance): bool

Whether a text instance is a legacy one: one with a visual flag is legacy when the flag is off, one filtered as content never is, nor blank text. Otherwise its text is legacy when it has a line break without the paragraph filter, a comment, an element or attribute the visual editor does not keep, or an element left empty.

staticsettled(array $instance, array $new): array

An updated text instance's flags settled: filtered when the new one asks, visual as the new one says (always for content filtering), and a visual instance always filtered.

@param array<array-key, mixed> $instance the instance with its title and text set
@param array<array-key, mixed> $new the settings as submitted
@return array<array-key, mixed>
statictext(object $widget, array $args, array $instance): string

The text widget's markup: a visual instance (visual and filtered, or filtered as content) through widget_text and widget_text_content; any other through widget_text, then paragraphs when it asks for them, then its shortcodes.

@param array<array-key, mixed> $args
@param array<array-key, mixed> $instance
staticcustomHtml(object $widget, array $args, array $instance): string

The custom HTML widget's markup: its content through widget_text (as a text instance would carry it) and widget_custom_html_content, the text widget's class first in the wrapper.

@param array<array-key, mixed> $args
@param array<array-key, mixed> $instance
staticgalleryAttributes(array $attrs): array

Gallery attributes inside a text or HTML widget: off a singular view, a gallery naming neither an id nor included images belongs to no post (-1).

@param array<array-key, mixed> $attrs
@return array<array-key, mixed>
insidewithoutPost()

WidgetForms final class

public/minn/src/Minn/Widgets/WidgetForms.php · 203 lines · Open the class →

The core widgets' settings forms, the markup a widget's form() prints and wp/v2/widgets returns as rendered_form, character for character as the reference prints it (probe rest-widgets): field ids and names from the widget's number, values escaped, defaults filled in. The whitespace is the reference's own and is part of the answer.

statictitle(Minn\Objects\Widget $widget, array $instance): string

The title field most widgets open with.

statictitleOnly(Minn\Objects\Widget $widget, array $instance): string

search, meta, calendar: the title alone.

staticpages(Minn\Objects\Widget $widget, array $instance): string

The pages widget: title, sort order, pages to leave out.

staticarchives(Minn\Objects\Widget $widget, array $instance): string

The archives widget: title, dropdown and counts boxes.

staticcategories(Minn\Objects\Widget $widget, array $instance): string

The categories widget: title, dropdown, counts and hierarchy boxes.

staticrecentPosts(Minn\Objects\Widget $widget, array $instance): string

The recent posts widget: title, how many, whether to show dates.

staticrecentComments(Minn\Objects\Widget $widget, array $instance): string

The recent comments widget: title and how many.

staticcustomHtml(Minn\Objects\Widget $widget, array $instance): string

The custom HTML widget: hidden title and content fields its editor syncs.

staticblock(Minn\Objects\Widget $widget, array $instance): string

The block widget: its block markup in a textarea.

statictext(Minn\Objects\Widget $widget, array $instance): string

The text widget in its visual mode: hidden fields the editor syncs (after the indent WP_Widget_Text::form prints first).

statictagCloud(Minn\Objects\Widget $widget, array $instance): string

The tag cloud: its title, the taxonomies that show a cloud (tags unless one is chosen), and the counts box.

staticnavMenu(Minn\Objects\Widget $widget, array $instance): string

The navigation menu widget: a note when there are no menus, else the title and the menu to show.

staticrss(array $args, array $inputs): string

wp_widget_rss_form: the feed's address, title, item count (1 to 20, 10 by default) and the three display boxes, each shown unless the caller hides it, and ticked when the settings say so (or, saying nothing, when it is shown).

@param array<string, mixed> $args
@param array<string, bool> $inputs
staticlinks(Minn\Objects\Widget $widget, array $instance, array $categories, string $limit): string

The Links widget: the link category (the categories given as [id, name]), the sort order, what each link shows, and how many (the limit as the caller shows it).

insidemarked(), number(), id(), name()

WidgetTemplates final class

public/minn/src/Minn/Widgets/WidgetTemplates.php · 85 lines · Open the class →

The Underscore templates the Text and Custom HTML widgets print for their controls (render_control_template_scripts), as the reference prints them (probe widget-methods): a title field and the content area, the Text widget's two hidden pointers, and, for a user who may not post unfiltered HTML, the note on the tags the code editor refuses. The whitespace is the reference's own and is part of the answer.

statictext(): string

The Text widget's template: title, the two pointers, the content area.

staticcustomHtml(): string

The Custom HTML widget's template for a user who may post unfiltered HTML.

staticcustomHtmlRestricted(): string

The Custom HTML widget's template for a user who may not, with the note (shown when the code editor is off) naming the unsafe tags a post may not hold (wp_kses_allowed_html); no note when it may hold them all.

insidecustomHtmlWith(), open(), pointer()