How can I execute a custom code on node edit/add page during hook_page_build? I'm seeking to show an extra form on node edit/add page. My function is this:

function mymodule_page_build(&amp;$page) {
  $node = menu_get_object();
  if($node &amp;&amp; $node-&gt;type == "object") {
    $page['page_bottom'][] = drupal_get_form('mymodule_form');


How can I check that current page is node edit/add page with a specific type like object?
The request_path() function can lookup the current path to determine what page is being rendered.

  if (request_path() == 'node/add/object') {
    // @TODO: Add code
  }
  else if (preg_match('/node\/\d+\/edit/', request_path())) {
    $node = menu_get_object();
    if ($node-&gt;type == 'object') {
      // @TODO: Add code for editing node
    }
  }