You can turn on output buffering, include
(and evaluate) the PHP file, and save the output (of the evaluated code) in a variable, like so:
ob_start();
include 'docs/row_layouts.php';
$html = ob_get_clean();
Then just use 'html' => $html
in the meta
array when you call the $admin_bar->add_menu()
.
Or if you don’t need to evaluate any PHP code in the file, you could use file_get_contents()
:
'html' => file_get_contents( 'docs/row_layouts.php' )
And you may need to or better use a full absolute path.