0

カスタムフォーマッター(Drupal、CCK)を使用してフィールドを作成しました。
今、私はこのPHPコードをエクスポートするようになりました

/**
* 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']);
}

CCKにモジュールとして追加しようとしましたが、フィールドに追加されませんでした。どうすればよいですか?

4

1 に答える 1

0

作成してエクスポートしたフォーマッターは、特定のフィールドのアクティブなフォーマッターとして選択する必要があります。これは、フォーマッターをエクスポートしなくても実行できます。

これを行うには、フォーマットする場所と内容によって異なりますが、一般に、ノードディスプレイのCCKフィールドである可能性が高く、コンテンツタイプの[ディスプレイフィールド]ページで設定できます。http:// [ www.yoursite.com/path/to/drupal]/admin/content/node-type/[content-type]/ display

于 2010-09-13T02:55:41.987 に答える