WordPress at a glance
function is not described

WP_Customize_Widgets::get_widget_control_parts() public WP 4.4.0

Retrieves the widget control markup parts.

{} It's a method of the class: WP_Customize_Widgets{}

No Hooks.

Return

Array.

  • control(string)
    Markup for widget control wrapping form.

  • content(string)
    The contents of the widget form itself.

Usage

$WP_Customize_Widgets = new WP_Customize_Widgets();
$WP_Customize_Widgets->get_widget_control_parts( $args );
$args(array) (required)
Widget control arguments.

Changelog

Since 4.4.0 Introduced.

Code of WP_Customize_Widgets::get_widget_control_parts() WP 5.5.1

<?php
public function get_widget_control_parts( $args ) {
	$args[0]['before_widget_content'] = '<div class="widget-content">';
	$args[0]['after_widget_content']  = '</div><!-- .widget-content -->';
	$control_markup                   = $this->get_widget_control( $args );

	$content_start_pos = strpos( $control_markup, $args[0]['before_widget_content'] );
	$content_end_pos   = strrpos( $control_markup, $args[0]['after_widget_content'] );

	$control  = substr( $control_markup, 0, $content_start_pos + strlen( $args[0]['before_widget_content'] ) );
	$control .= substr( $control_markup, $content_end_pos );
	$content  = trim(
		substr(
			$control_markup,
			$content_start_pos + strlen( $args[0]['before_widget_content'] ),
			$content_end_pos - $content_start_pos - strlen( $args[0]['before_widget_content'] )
		)
	);

	return compact( 'control', 'content' );
}