hook_node_info()
, but you still have to go into the interface and manually configure parameters such as displaying comments, publishing settings, displaying the date / author, and other things that hook_node_info()
does not cover. And each time using crutches like variable_set is inconvenient.<?php
function hook_node_info() {
return array(
'customtype' => array(
'name' => t( 'Custom node type' ),
'base' => 'custom' ,
...
// Extra properties
'node-preview' => 0,
'node-options' => array( 'status' , 'promote' , 'sticky' , 'revision' ),
'node-submitted' => 0,
'comment' => array(
'status' => 2,
'default-mode' => 1,
'anonymous' => 1,
'default-per-page' => 50,
'form-location' => 1,
'preview' => 0,
'subject-field' => 0,
),
),
);
}
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/135883/
All Articles