Drupal: How to Get Know Type of Current Node
Problem:
It is necessary to get know type of the displayed node. There is no such info in Edit form.
Solution:
Alternatives
- Block with РНР code that shows node type
- Nodetype module
Block with PHP code that shows node type
Create a block with PHP input format and insert the following code to the block body:
<?php
if (arg(0)==’node’ && is_numeric(arg(1))) {
$node = node_load(arg(1));
echo ‘Тип текущей ноды: ‘. $node->type;
}
?>
Bock visibility: “Show block on specific pages: Show on every page except the listed pages." The block will be shown on nodes’ pages only – this is defined in the code.
It is better to show the lock for site admin only – just specify the desired role.
Nodetype module
You can install Nodetype module which allows to change node type.
ON the edit page for a node, you will find the drop-down list (select list). The current node type will be the default there. Select the node type and save settings.








