2012-01-26 8 views
0

私はテーブルの下部に要素を追加することができました。私はあなたがどのように表の本体にcoloumnを追加するかわかりませんが?新しいカスタムフィールド/列をコンテンツ管理に追加する

function seven_form_alter(&$form, &$form_state, $form_id) { 
     drupal_set_message("Form ID is : " . $form_id); 

     //get node_admin_content 
     //$nodeAdmin = drupal_get_form("node_admin_content"); 


      // Add a checkbox to registration form about agreeing to terms of use. 
    $form['node_admin_content']['poland'] = array(
    '#type' => 'checkbox', 
    '#title' => t("I agree with the website's terms and conditions."), 
    '#required' => TRUE, 
); 

} 

答えて

1

テーブルはnode_admin_nodes()によって構築され、あなたがそれをオーバーライドすることができるように配列をレンダリング素敵に付属しています:

// Get the header array and add your new column header 
$header = $form['admin']['nodes']['#header']; 
$header['new_column'] = array('data' => 'New Col Header'); 
$form['admin']['nodes']['#header'] = $header; 

// Get the table rows and add your new column to each. 
// The function used to output the table depends on the user permissions 
// so you need to check what type of object is being rendered. 
if (isset($form['admin']['nodes']['#options'])) { 
    $row_key = '#options'; 
} 
else { 
    $row_key = '#rows'; 
} 

$rows = $form['admin']['nodes'][$row_key]; 

foreach ($rows as $nid => $row) { 
    $form['admin']['nodes'][$row_key][$nid]['new_column'] = array('data' => 'Text'); 
} 
+0

あなたの助けの男をいただき、ありがとうございます。だから私たちはどのようにa)ライブデータをcoloumnに入れるのですか?b)それを注文可能なasc、descにするにはどうしたらいいですか? –

+0

これは非常に面倒ですが、クエリは 'node_admin_nodes()'にハードコードされており、ヘッダによる順序は実行前にそのクエリに追加されています。私が考えることができる唯一の方法は、独自のバージョンのnode_admin_nodes()を書き直し、新しいヘッダ/ジョインをクエリに追加し、 '$ form ['admin'] ['nodes']の出力を置き換えることです'全部。それが意味をなさない場合は、別の質問をしてください。誰かが助けることができます。また、http://drupal.stackexchange.com/をチェックしてください。Drupal開発者のための良いリソースです:) – Clive

+0

ありがとうございます - 私はテーブルから列を削除する必要があり、このコードは私を助けました! – jackocnr

関連する問題