문제

Situation:

  • Drupal 6 node module defining custom content type
  • Necessity to have an automated alias for the content type, e.g. content_type/[title-raw]

Question: How can I programmatically set the Automated alias setting of the new content type to the above pattern in the hook_install?

도움이 되었습니까?

해결책

Solution is trivial, automated alias patterns of Drupal are stored in variables:

function hook_install()
{
    variable_set('pathauto_node_[content_type]_pattern', 'content_type_path/[title-raw]');
}

where content_type refers to the machine-readable name of the content type and content_type_path is the desired prefix of the alias of the content type.

The solution was fetched from the post at http://drupal.org/node/1246334#comment-5038566

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top