0
votes

I want to access content type description in custom template file of Drupal7 website. In this template file I'm showing list of content. On top of that list now i want to display description also for that content type.

Content type name is accessible using this. Is there any way to access the description also?

$types = node_type_get_names('names');

Found this in drupal forum but node_get_types function is throwing error.

$types = node_get_types();
print $types['blog']->description;
1

1 Answers

2
votes

I think you may be looking for

node_type_get_types

https://api.drupal.org/api/drupal/modules%21node%21node.module/function/node_type_get_types/7.x

Someone posted a dump of the object in the api docs, but I'll copy it here for completeness.

Array
(
[article] => stdClass Object
  (
  [type] => article
  [name] => Article
  [base] => node_content
  [module] => node
  [description] => Use articles for time-sensitive content like news, press releases or blog posts.
  [help] => 
  [has_title] => 1
  [title_label] => Title
  [custom] => 1
  [modified] => 1
  [locked] => 0
  [disabled] => 0
  [orig_type] => article
  [disabled_changed] => 
)