2013-09-02 3 views
1

이미 내 drupal 프로젝트에 콘텐츠 유형이 있습니다.drupal 7 콘텐츠 유형을 자동으로 코드로 변환하십시오. 콘텐츠 형식 생성기 코드?

현재 내 자신의 모듈로 작업하고 있으며 내장 된 콘텐츠 형식을 만들고 싶습니다. Drupal에서 직접 작성한 컨텐트 유형을 코드로 변환하는 방법이 있습니까? 일종의 콘텐츠 유형 코드 생성기?

가능한 경우 자동으로이 코드를 생성하고 싶습니다.

$t = get_t(); 

    // Define the node type. 
    $slider = array(
    'type' => 'slider', 
    'name' => $t('Slider Content'), 
    'base' => 'node_content', 
    'description' => $t('This is an example node type with a few fields.'), 
    'body_label' => $t('Example Description') 
); 

    // Complete the node type definition by setting any defaults not explicitly 
    // declared above. 
    // http://api.drupal.org/api/function/node_type_set_defaults/7 
    $content_type = node_type_set_defaults($slider); 
    node_add_body_field($content_type); 

    // Save the content type 
    node_type_save($content_type); 

고마워요.

답변

2

은 어쩌면 당신은 Features module 살펴 있어야합니다. 기능을 사용하면 추가 된 필드와 함께 컨텐츠 유형을 나중에 다른 사이트에 설치할 수있는 모듈로 내보낼 수 있습니다.

체크 this documentation link.

+0

고마워, 내가 필요한 것 : –

관련 문제