특정 콘텐츠 형식의 노드/추가 양식을 여러 단계로 변경하려고합니다.Drupal 다중 단계 노드 폼 마지막 단계가 아닐 경우 저장하지 않기
(drupal6, 멀티 그룹에 대한 CCK dev에 3 배()) 나는 주위에 내 머리를 정리하고 실제로 2 단계로 1 단계 제출 및 이행에 노드를 만들 수 양식을 방지하기 위해 어떻게 할 수없는 무엇
.
지금 단계가 2 일 가능성은 없지만 저장을 방지하는 방법을 알 수는 없습니다.
퍼팅 $ 양식 [ "# 제출"] = 배열 () 다음 내 [ "# 제출"] 핸들러 (이것은이 여전히 저장됩니다 작동하지 않습니다) 추가 :
나는 다음 시도
비어있는 리턴 만 시도했지만 여전히 노드가 저장됩니다. 그 자체로 별도 제출 버튼을 추가
* HOOK FORM ALTER */
function armormod_form_alter(&$form, $form_state, $form_id) {
//print_r($form);
//print_r($form_state);
//print_r($form_id);
if($form_id = "seed_node_form") {
//set the default step
if(!isSet($form_state["storage"]["step"])) {
$form_state["storage"]["step"] = 1;
}
// Add an after_build function to process when everything's complete.
$form['#after_build'][] = 'armormod_after_build';
/* clear the submit (this doesn't work)
Normally calls menu_node_form_submit and then upload_node_form_submit
*/
//$form["#submit"] = array();
$form["#submit"][] = "armormod_submit";
$form["#validate"][] = "armormod_validate";
}
}
function armormod_submit($form, &$form_state) {
if($form["form_id"]["#value"] == "seed_node_form") {
if($form_state["storage"]["step"] < 2) {
drupal_set_message("Form Step:".$form_state["storage"]["step"]);
return;
}
} else {
return $form;
}
}
function armormod_validate($form, &$form_state) {
if($form["form_id"]["#value"] == "seed_node_form") {
drupal_set_message(t("Validation Called"), "status");
return;
} else {
return $form;
}
}
/* AFTER BUILD LETS US MODIFY CCK FORM ELEMENTS */
function armormod_after_build($form, &$form_state) {
if($form["form_id"]["#value"] == "seed_node_form") {
if($form_state["storage"]["step"] == 2) {
drupal_set_message(t("Step 2 Build Called"), "status");
$form["group_statistics"]["#access"] = 1;
$form["buttons"]["submit"]["#value"] = "Save";
} else {
drupal_set_message(t("After Build Called"), "status");
//hide statistics group
$form["group_statistics"]["#access"] = false;
$form["buttons"]["submit"]["#value"] = "Next Step";
unset($form["buttons"]["preview"]);
//print_r($form);
}
}
return $form;
}
이 모듈은 cck로 다중 그룹을 지원하지 않으며, 두 번째 필드에서 드롭 다운 값을 만들기 위해 첫 번째 단계에서 일부 필드를 사용해야합니다. – merlincam