We removed the $page parameter from hook_view() and hook_node_view() recently, and replaced it at some places by (bool) menu_get_object(). However, those are *not* equivalent (think: a full-node View displayed on a node/xxx page).

Because those are generally altering pages (altering the breadcrumb, modifying the page title, etc.), we need to move all the implementations to hook_page_alter().

Comments

damien tournoud’s picture

Priority: Normal » Critical

Seeing tha_sun comments on #445902: (bool) menu_get_object() is *not* an equivalent of $page, there are also use cases of a "full page view" on something that is not a full page (think panels), so we probably need a special alter hook at the bottom of node_show().

sun’s picture

subscribing

moshe weitzman’s picture

Well, we need to approach this from the book.module's point of view (for example). Assuming we are dealing with a node thats in a book, when does it want its footer to be shown

  1. On node detail pages (today)
  2. On non teaser node presentations.
  3. When admin says that it should appear (BUILD_MODE). Use reasonable defaults of course.

I don't know the right answer here, but I have some distaste for adding a new drupal_alter() to fix this. It sounds too special case.

sun’s picture

ok. I think what we want is:

- Remove the $teaser argument, too.

- Turn $teaser into a node BUILD_MODE.

That would

- make the teaser output highly configurable, less hard-coded

- remove nasty magic from core for node teasers

- remove the confusion we have with $teaser and (gone) $page now.

- probably help in our quest to split the node body field into separate body and teaser fields.

moshe weitzman’s picture

i think thats sane. yched and eaton have done some thinking on this. would be good to hear from them.

catch’s picture

I hate the teaser and page variables but we shouldn't just kill them without alternatives. Ideas here are good, subscribing etc.

yched’s picture

$teaser : Please please read and comment on #409750: Overhaul and extend node build modes. This is exactly what it is about.

sun’s picture

Issue tags: +API clean-up

Tagging for feature freeze.

sun’s picture

Issue tags: +D7 API clean-up

Tagging absolutely critical clean-ups for D7. Do not touch this tag. Please either help with this or one of the other patches having this tag.

What's left in here? Will Panels be able to render an arbitrary node view in a full node view?

sun’s picture

Status: Active » Closed (duplicate)

Studying this issue once again, I think that #409750: Overhaul and extend node build modes accounted for everything that has been mentioned in here. Hence, marking as duplicate.

damien tournoud’s picture

Status: Closed (duplicate) » Active

There are still several (bool)menu_get_object() in core. I guess those need to be fixed?

sun’s picture

Right.

includes\theme.inc(2165):            if ($node = menu_get_object()) {
includes\theme.inc(2254):            if ($node = menu_get_object()) {
modules\block\block.module(696):     $node = menu_get_object();
modules\blog\blog.module(61):        if ((bool)menu_get_object()) {
modules\book\book.module(231):       if ($node = menu_get_object()) {
modules\book\book.module(761):       if (($node = menu_get_object()) && !empty($node->book['bid'])) {
modules\comment\comment.module(582): $page_node = menu_get_object();
modules\forum\forum.module(168):     if ((bool)menu_get_object()) {
modules\node\node.api.php(958):      if ((bool)menu_get_object()) {
modules\node\node.module(1311):      $variables['page']      = (bool)menu_get_object();
modules\system\system.api.php(487):  if (menu_get_object('node', 1)) {
damien tournoud’s picture

Status: Active » Closed (duplicate)
gábor hojtsy’s picture

While #658314: $page variable in node.tpl.php is buggy attempted to solve this issue for some cases, the current code still works so that you cannot display the same node in a different build mode on its own page. It always displays in full mode regardless of what you ask it to do: #721754: A node cannot be displayed in different view mode on its own page.

gisle’s picture

Issue summary: View changes
Issue tags: -D7 API clean-up

Removing non-canonical duplicate tag. See #2426171: Multiple tags similar to 'API clean-up' for background.