@Dave224, the approach that I've taken for the heading/content injections is for the watching observers to add their content in the order in which they're loaded (via their associated auto-loader). That way, the outcome is repeatable and, as you indicated, also controllable by adjusting the content-adding plugins' auto-load checkpoints.
Here's a section from one such plugin, showing how I handle the header-addition (content-addition uses a similar approach):
Code:
// -----
// Issued by /admin/orders.php when generating the orders' listing, allowing the
// insert of an additional column heading.
//
// On entry:
//
// $p2 ... Contains a reference to the $extra_headings array, to be returned in the
// following format:
//
// $extra_headings = array(
// array(
// 'align' => $alignment, // One of 'center', 'right', or 'left' (optional)
// 'text' => $value
// ),
// );
//
// Note: Be sure to check that the $p2/$extra_headings value is specifically (bool)false before initializing, since
// multiple observers might be injecting content!
//
case 'NOTIFY_ADMIN_ORDERS_LIST_EXTRA_COLUMN_HEADING':
if ($p2 === false) {
$p2 = array();
}
$p2[] = array(
'align' => 'center',
'text' => MYPLUGIN_ORDERS_HEADING_STATUS
);
break;
Bookmarks