It would be useful to display content types submission guidelines (admin/content/node-type/your-type > Submission form settings) at the top of the respective page in the route.

They would help admins explain users what they need to do in the form.

cheers

Comments

sepgil’s picture

Status: Active » Closed (fixed)

It was decided to kick out the Node Managment page type(http://drupal.org/node/558862) and since this bug only appears on the sub pages(edit or add) of Node Managment, there nothng left to fix.

sepgil’s picture

Status: Closed (fixed) » Active

damn wrong issue, I'm very sorry....

NaX’s picture

Status: Active » Needs work

The problem here is that pageroute is not implementing hook_help().

I created two version of hook_help(). The first one is the simplest but requires loading the full page route object.
I don't know how efficient the pageroute class is and how much is cached so I looked into a second method that is more code but avoids load the pageroute object unless absolutely needed.

If you put any of these 2 version into your pageroute.module file it should work. I put it above pageroute_menu() function after the define() constants.

Version one:

/**
 * Implementation of hook_help().
 */
function pageroute_help($path, $arg) {
  // Check all routes for valid path
  $route_result = db_query('SELECT * FROM {pageroute_routes} WHERE path = "%s"', $path);
  if ($route_result) {
    if ($route_data = db_fetch_object($route_result)) {    
      // Building pageroute object and get node type from current.
      $route = &PagerouteRoute::load($route_data->prid);
      $route->start(NULL);
      $node_type = $route->pageDataCurrent->options['content-type'];  
      
      // Get node type help.
      if ($node_type) {
        $type = node_get_types('type', $node_type);
        return (!empty($type->help) ? '<p>'. filter_xss_admin($type->help) .'</p>' : '');
      }
    }
  }
}

Version Two:

/**
 * Implementation of hook_help().
 */
function pageroute_help($path, $arg) {
  // Check all routes for valid path
  $route_result = db_query('SELECT * FROM {pageroute_routes} WHERE path = "%s"', $path);
  if ($route_result) {
    if ($route_data = db_fetch_object($route_result)) {
      // Valid path found.
      // Find page name from args.
      $page_name = NULL;
      $path_args = explode('/', $path);
      $page_name_args = array_diff($arg, $path_args);
      // Should always be first arg after path.
      foreach ($page_name_args as $page_name_arg) {
        if (!empty($page_name_arg)) {
          $page_name = $page_name_arg;
          break;
        }
      }
      // Get node type for pageroute.
      $node_type = NULL;
      if ($page_name) {
        $page_result = db_query('SELECT * FROM {pageroute_pages} WHERE prid = %d AND name ="%s"', $route_data->prid, $page_name);
        if ($page_result) {
          if ($page_date = db_fetch_object($page_result)) {
            $page_date->options = unserialize($page_date->options);
            $node_type = $page_date->options['content-type'];
          }
        }
      }
      // No page found from args building pageroute object instead.
      else {
        $route = &PagerouteRoute::load($route_data->prid);
        $route->start(NULL);
        $node_type = $route->pageDataCurrent->options['content-type'];        
      }
      
      // Get node type help.
      if ($node_type) {
        $type = node_get_types('type', $node_type);
        return (!empty($type->help) ? '<p>'. filter_xss_admin($type->help) .'</p>' : '');
      }
    }
  }
}