質問

(注意:私はもともと私はあそこの応答を取得することはありませんことを覚えて前にdrupal.orgに投稿ので、クロスポストして申し訳ありません)。

こんにちは、特にCCKノードタイプの前処理機能を追加するために(内蔵または他の)方法はありますか?私は私のCCKノードタイプ内のフィールドのいくつかの前処理を行うために探しています。現在、私はtheme_preprocess_nodeを使用して、$ノード - >入力するか、または使用テーマ機能を特定のフィールド名のために(まだ現在のフィールドの使用は、私が探していたノードタイプ内であることを確認するようにスイッチを行う上でスイッチを行うことができますいずれかために)。私は何を示唆していますがこのような機能を持っていることです...

theme_preprocess_mynodetype(&$vars) {
    // Now I can preprocess a field without testing whether the field is within the target content type
}

...しかし、私は、前処理機能私はテンプレートファイルを示唆するのと同じ方法を提案することができれば、私は把握することはできません。

ありがとう!ロブ

他のヒント

CCKのcontent.moduleでこの機能を参照してください。


/**
 * Theme preprocess function for field.tpl.php.
 *
 * The $variables array contains the following arguments:
 * - $node
 * - $field
 * - $items
 * - $teaser
 * - $page
 *
 * @see field.tpl.php
 *
 * TODO : this should live in theme/theme.inc, but then the preprocessor
 * doesn't get called when the theme overrides the template. Bug in theme layer ?
 */
function content_preprocess_content_field(&$variables) {
  $element = $variables['element'];
...

scroll top