체크박스 형태의 4방향 톱니 관련 CCK 설정 예
상하이님.
체크박스 형태의 4방향 톱니 관련 CCK 설정 예입니다.
참고해 주세요.
'name' => 'tooth',
'type' => 'tooth',
'description' => '',
'title_label' => 'タイトル',
'body_label' => '本文',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => true,
'sticky' => false,
'revision' => false,
),
'language_content_type' => '0',
'upload' => '1',
'show_preview_changes' => 1,
'old_type' => 'tooth',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'comment' => '2',
'comment_default_mode' => '4',
'comment_default_order' => '1',
'comment_default_per_page' => '50',
'comment_controls' => '3',
'comment_anonymous' => 0,
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '0',
'feedapi' =>
array (
'enabled' => 0,
'refresh_on_create' => 0,
'update_existing' => 1,
'skip' => 0,
'items_delete' => '0',
'parsers' =>
array (
'parser_simplepie' =>
array (
'enabled' => 0,
'weight' => '0',
),
'parser_common_syndication' =>
array (
'enabled' => 0,
'weight' => '0',
),
),
'processors' =>
array (
'feedapi_node' =>
array (
'enabled' => 0,
'weight' => '0',
'content_type' => 'story',
'node_date' => 'feed',
'promote' => '3',
'x_dedupe' => '0',
),
'feedapi_inherit' =>
array (
'enabled' => 0,
'weight' => '0',
'inherit_taxonomy' => 1,
),
),
),
'better_formats_allowed' =>
array (
1 => true,
2 => true,
3 => true,
4 => false,
5 => false,
6 => false,
7 => false,
8 => false,
9 => false,
10 => false,
),
'better_formats_defaults' =>
array (
'node-1' =>
array (
'format' => '0',
'weight' => '0',
),
'node-2' =>
array (
'format' => '0',
'weight' => '0',
),
'node-3' =>
array (
'format' => '0',
'weight' => '0',
),
'node-4' =>
array (
'format' => '0',
'weight' => '25',
),
'node-5' =>
array (
'format' => '0',
'weight' => '25',
),
'node-6' =>
array (
'format' => '0',
'weight' => '25',
),
'node-7' =>
array (
'format' => '0',
'weight' => '25',
),
'node-8' =>
array (
'format' => '0',
'weight' => '25',
),
'node-9' =>
array (
'format' => '0',
'weight' => '25',
),
'node-10' =>
array (
'format' => '0',
'weight' => '25',
),
'node-11' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-1' =>
array (
'format' => '0',
'weight' => '0',
),
'comment-2' =>
array (
'format' => '0',
'weight' => '0',
),
'comment-3' =>
array (
'format' => '0',
'weight' => '0',
),
'comment-4' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-5' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-6' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-7' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-8' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-9' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-10' =>
array (
'format' => '0',
'weight' => '25',
),
'comment-11' =>
array (
'format' => '0',
'weight' => '25',
),
),
);
$content['groups'] = array (
0 =>
array (
'label' => 'check_by_four',
'group_type' => 'standard',
'settings' =>
array (
'form' =>
array (
'style' => 'fieldset',
'description' => '',
),
'display' =>
array (
'description' => '',
'teaser' =>
array (
'format' => 'fieldset',
'exclude' => 0,
),
'full' =>
array (
'format' => 'fieldset',
'exclude' => 0,
),
4 =>
array (
'format' => 'fieldset',
'exclude' => 0,
),
'label' => 'above',
),
),
'weight' => '0',
'group_name' => 'group_check_by_four',
),
);
$content['fields'] = array (
0 =>
array (
'label' => 'four_l2',
'field_name' => 'field_four_l2',
'type' => 'number_integer',
'widget_type' => 'optionwidgets_buttons',
'change' => '基本情報の変更',
'weight' => '1',
'description' => '',
'default_value' =>
array (
0 =>
array (
'value' => '',
),
),
'default_value_php' => '',
'default_value_widget' => NULL,
'group' => 'group_check_by_four',
'required' => 0,
'multiple' => '4',
'min' => '1',
'max' => '4',
'prefix' => '',
'suffix' => '',
'allowed_values' => '1
2
3
4',
'allowed_values_php' => '',
'op' => 'フィールド設定の保存',
'module' => 'number',
'widget_module' => 'optionwidgets',
'columns' =>
array (
'value' =>
array (
'type' => 'int',
'not null' => false,
'sortable' => true,
),
),
'display_settings' =>
array (
'label' =>
array (
'format' => 'above',
'exclude' => 0,
),
'teaser' =>
array (
'format' => 'default',
'exclude' => 0,
),
'full' =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
1 =>
array (
'label' => 'four_l1',
'field_name' => 'field_four_l1',
'type' => 'number_integer',
'widget_type' => 'optionwidgets_buttons',
'change' => '基本情報の変更',
'weight' => '2',
'description' => '',
'default_value' =>
array (
0 =>
array (
'value' => '',
),
),
'default_value_php' => '',
'default_value_widget' =>
array (
'field_four_l1' =>
array (
'value' =>
array (
'' => 1,
1 => false,
2 => false,
3 => false,
4 => false,
),
),
),
'group' => 'group_check_by_four',
'required' => 0,
'multiple' => '4',
'min' => '1',
'max' => '4',
'prefix' => '',
'suffix' => '',
'allowed_values' => '1
2
3
4',
'allowed_values_php' => '',
'op' => 'フィールド設定の保存',
'module' => 'number',
'widget_module' => 'optionwidgets',
'columns' =>
array (
'value' =>
array (
'type' => 'int',
'not null' => false,
'sortable' => true,
),
),
'display_settings' =>
array (
'label' =>
array (
'format' => 'above',
'exclude' => 0,
),
'teaser' =>
array (
'format' => 'default',
'exclude' => 0,
),
'full' =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
2 =>
array (
'label' => 'four_r1',
'field_name' => 'field_four_r1',
'type' => 'number_integer',
'widget_type' => 'optionwidgets_buttons',
'change' => '基本情報の変更',
'weight' => '3',
'description' => '',
'default_value' =>
array (
0 =>
array (
'value' => '',
),
),
'default_value_php' => '',
'default_value_widget' =>
array (
'field_four_r1' =>
array (
'value' =>
array (
'' => 1,
1 => false,
2 => false,
3 => false,
4 => false,
),
),
),
'group' => 'group_check_by_four',
'required' => 0,
'multiple' => '4',
'min' => '1',
'max' => '4',
'prefix' => '',
'suffix' => '',
'allowed_values' => '1
2
3
4',
'allowed_values_php' => '',
'op' => 'フィールド設定の保存',
'module' => 'number',
'widget_module' => 'optionwidgets',
'columns' =>
array (
'value' =>
array (
'type' => 'int',
'not null' => false,
'sortable' => true,
),
),
'display_settings' =>
array (
'label' =>
array (
'format' => 'above',
'exclude' => 0,
),
'teaser' =>
array (
'format' => 'default',
'exclude' => 0,
),
'full' =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
3 =>
array (
'label' => 'four_r2',
'field_name' => 'field_four_r2',
'type' => 'number_integer',
'widget_type' => 'optionwidgets_buttons',
'change' => '基本情報の変更',
'weight' => '4',
'description' => '',
'default_value' =>
array (
0 =>
array (
'value' => '',
),
),
'default_value_php' => '',
'default_value_widget' =>
array (
'field_four_r2' =>
array (
'value' =>
array (
'' => 1,
1 => false,
2 => false,
3 => false,
4 => false,
),
),
),
'group' => 'group_check_by_four',
'required' => 0,
'multiple' => '4',
'min' => '1',
'max' => '4',
'prefix' => '',
'suffix' => '',
'allowed_values' => '1
2
3
4',
'allowed_values_php' => '',
'op' => 'フィールド設定の保存',
'module' => 'number',
'widget_module' => 'optionwidgets',
'columns' =>
array (
'value' =>
array (
'type' => 'int',
'not null' => false,
'sortable' => true,
),
),
'display_settings' =>
array (
'label' =>
array (
'format' => 'above',
'exclude' => 0,
),
'teaser' =>
array (
'format' => 'default',
'exclude' => 0,
),
'full' =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
);
$content['extra'] = array (
'title' => '-5',
'body_field' => '-3',
'menu' => '-4',
'attachments' => '-2',
);
template.php 에는 다음과 같이 추가하면 되겠지요.
<?php
if ((arg(0) == "node") && (arg(1) == "add") && (arg(2) == "tooth")){
function phptemplate_node_form($form) {
drupal_set_message( "rendered - add form" );
return drupal_render($form);
}
}
if ((arg(0) == "node") && (arg(2) == "edit")){
$node = node_load(array("nid" => arg(1)));
if ($node->type == "tooth"){
function phptemplate_node_form($form) {
drupal_set_message( "rendered - edit form" );
return drupal_render($form);
& & & }
& }
}
주의) 드루팔 모듈이나 테마에 사용하는 PHP코드들은
<span style="color: #000000"><span style="color: #0000BB">&<?php
</span><span style="color: #007700">---
</span><span style="color: #0000BB">?&></span></span>
중에서 닫는 태그 ?>를 사용하면 안됩니다.
보통은 닫는게 정석이지만 모듈과 테마에서는 예외입니다.
2009/09 추가) 코드 필터가 이상하게 작동해서, 아래 쪽 부분의 소스코드가 엉망이네요.


위 본문 CCK에 새로운
위 본문 CCK에 새로운 디자인을 적용하고 싶다면,
아래 자료들을 참고해 보십시오.
CCK로 만든 컨텐츠 타입의 Theming 적용법은 아래 주소를 강추.
http://drupal.org/node/101092
http://www.lullabot.com/articles/modifying-forms-5-and-6
How to theme a Drupal form
http://agaric.com/note/how-theme-drupal-form
theme-settings.php ファイル 에 관한 설명
http://drupalxdrupal.com/book/371
Drupal 6 theme guide
http://drupal.org/theme-guide/6
Drupal 6의 Form-API에 관한 문서
http://api.drupal.org/api/group/form_api/6
http://api.drupal.org/api/file/developer/topics/forms_api.html
Adding a select all checkbox to your drupal form
http://www.theroamingcoder.com/node/19
Checkboxes in forms step by step
http://blog.riff.org/2008_08_12_checkboxes_forms_step_step
드루팔에서 테마
드루팔에서 테마 적용하는 여러 방식을 모은 페이지입니다.
http://drupal.org/node/45471
테마에서 특정 부분을 삭제하고 싶을 때 사용하는 팁입니다.
http://drupal.org/node/368776