2010-08-23 6 views
0

커스텀 포맷터 (Drupal, CCK)를 사용하여 필드를 만들었습니다.
지금 나는 CCK의 모듈로 추가하려고사용자 정의 포맷터에서 필드로?

/** 
* Implements hook_theme(). 
*/ 
function product_attribute_theme() { 
    return array(
    'product_attribute_formatter_product_attribute' => array(
     'arguments' => array('element' => NULL), 
    ), 
); 
} 

/** 
* Implements hook_field_formatter_info(). 
*/ 
function product_attribute_field_formatter_info() { 
    return array(
    'product_attribute' => array(
     'label' => 'Product Attribute', 
     'description' => t('an Attribute of a Product'), 
     'field types' => array('content_taxonomy', 'text'), 
     'multiple values' => CONTENT_HANDLE_MODULE, 
    ), 
); 
} 

function theme_product_attribute_formatter_product_attribute($element) { 
    return ($element['#item']['value']); 
} 

를 내보내려면이 PHP 코드를 가지고 있지만 난 그렇게 어떻게해야합니까, 필드에 추가하지 않았다?

답변

0

작성하고 내 보낸 포맷터는 특정 필드의 활성 포맷터로 선택해야합니다.이 포맷터는 포맷터를 내 보내지 않고도 수행 할 수 있습니다.

이렇게하려면 형식을 지정하려는 위치와 대상에 따라 다르지만 일반적으로 콘텐츠 형식 '표시 필드'페이지에서 설정할 수있는 노드 표시에서 CCK 필드가 될 가능성이 높습니다. http://[www.yoursite.com/path/to/drupal]/admin/content/node-type/[content-type]/display

관련 문제