ACF_Walker_Nav_Menu_Edit::start_el()publicACF 5.0.0

Starts the element output.

Calls the Walker_Nav_Menu_Edit start_el function and then injects the custom field HTML

Метод класса: ACF_Walker_Nav_Menu_Edit{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ACF_Walker_Nav_Menu_Edit = new ACF_Walker_Nav_Menu_Edit();
$ACF_Walker_Nav_Menu_Edit->start_el( $output, $item, $depth, $args, $id );
$output(строка) (обязательный) (передается по ссылке — &)
Used to append additional content (passed by reference).
$item(WP_Post) (обязательный)
Menu item data object.
$depth(int)
Depth of menu item. Used for padding.
$args(stdClass)
An object of wp_nav_menu() arguments.
По умолчанию: array()
$id(int)
Current item ID.

Список изменений

С версии 5.0.0 Введена.
С версии 5.7.2 Added preg_replace based on https://github.com/ineagu/wp-menu-item-custom-fields

Код ACF_Walker_Nav_Menu_Edit::start_el() ACF 6.0.4

function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {

	// vars
	$item_output = '';

	// call parent function
	parent::start_el( $item_output, $item, $depth, $args, $id );

	// inject custom field HTML
	$output .= preg_replace(
	// NOTE: Check this regex from time to time!
		'/(?=<(fieldset|p)[^>]+class="[^"]*field-move)/',
		$this->get_fields( $item, $depth, $args, $id ),
		$item_output
	);
}