Drupal theme code to work out if you are editing a node
Asked Answered
P

2

5

Does anyone know the php code to check if you are in edit mode? I want to edit how my theme looks when in edit mode so need to work out if I am or not.

Pendant answered 22/4, 2010 at 9:58 Comment(0)
A
2

You can also make a page template to handle this. Check this from http://drupal.org/node/190815:

The list of suggested template files in order of specificity based on internal paths. One suggestion is made for every element of the current path, though numeric elements are not carried to subsequent suggestions. For example, "http://www.example.com/node/1/edit" would result in the following suggestions:

  1. page-node-edit.tpl.php
  2. page-node-1.tpl.php
  3. page-node.tpl.php
  4. page.tpl.php
Ametropia answered 22/4, 2010 at 21:2 Comment(0)
K
11

You can check url arguments as shown here.

if(arg(0) == 'node' && arg(2) == 'edit'){ /*...*/}
Kawasaki answered 22/4, 2010 at 10:44 Comment(0)
A
2

You can also make a page template to handle this. Check this from http://drupal.org/node/190815:

The list of suggested template files in order of specificity based on internal paths. One suggestion is made for every element of the current path, though numeric elements are not carried to subsequent suggestions. For example, "http://www.example.com/node/1/edit" would result in the following suggestions:

  1. page-node-edit.tpl.php
  2. page-node-1.tpl.php
  3. page-node.tpl.php
  4. page.tpl.php
Ametropia answered 22/4, 2010 at 21:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.