Code Duplication    Length = 20-20 lines in 2 locations

src/wp-includes/class-wp-customize-nav-menus.php 1 location

@@ 843-862 (lines=20) @@
840
	 * @param string      $partial_id   Partial ID.
841
	 * @return array Partial args.
842
	 */
843
	public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
844
845
		if ( preg_match( '/^nav_menu_instance\[[0-9a-f]{32}\]$/', $partial_id ) ) {
846
			if ( false === $partial_args ) {
847
				$partial_args = array();
848
			}
849
			$partial_args = array_merge(
850
				$partial_args,
851
				array(
852
					'type'                => 'nav_menu_instance',
853
					'render_callback'     => array( $this, 'render_nav_menu_partial' ),
854
					'container_inclusive' => true,
855
					'settings'            => array(), // Empty because the nav menu instance may relate to a menu or a location.
856
					'capability'          => 'edit_theme_options',
857
				)
858
			);
859
		}
860
861
		return $partial_args;
862
	}
863
864
	/**
865
	 * Add hooks for the Customizer preview.

src/wp-includes/class-wp-customize-widgets.php 1 location

@@ 1481-1500 (lines=20) @@
1478
	 * @param string      $partial_id   Partial ID.
1479
	 * @return array (Maybe) modified partial arguments.
1480
	 */
1481
	public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
1482
1483
		if ( preg_match( '/^widget\[(?P<widget_id>.+)\]$/', $partial_id, $matches ) ) {
1484
			if ( false === $partial_args ) {
1485
				$partial_args = array();
1486
			}
1487
			$partial_args = array_merge(
1488
				$partial_args,
1489
				array(
1490
					'type'                => 'widget',
1491
					'render_callback'     => array( $this, 'render_widget_partial' ),
1492
					'container_inclusive' => true,
1493
					'settings'            => array( $this->get_setting_id( $matches['widget_id'] ) ),
1494
					'capability'          => 'edit_theme_options',
1495
				)
1496
			);
1497
		}
1498
1499
		return $partial_args;
1500
	}
1501
1502
	/**
1503
	 * Adds hooks for selective refresh.