hook_form a cck
Zdravím,
pokouším se vytvořit svůj vlastní modul, ale narazil jsem na drobný problém, se kterým mi google moc nepomohl (asi blbě hledám :) ). V modulu si definuji vlastní content-type formulář, ale nemohu zanic dojít na to, abych mohl potom v nastevení tohoto typu obsahu změnit popisky u polí $form[„items“] a $form[„category“] (jde to pouze u title a body – asi jsou nějak defaultně nastaveny. V kódu to jsou pole $form[„title“] a $form[„body“]) viz obr. editace_popisku_typu_obsahu.gif . Také tato pole nevidím v seznamu v „manage fields“ viz obr manage_fields.gif
Je na to nějaká funkce, abych mohl tato pole „zviditelnit“ v editaci a moci je tak měnit, seřazovat apod?
Přikládám funkci fileshare_form , ve které ten formulář definuji<? function fileshare_form(&$node, $form_state) { global $user; $type = node_get_types('type', $node); $form = array( '#cache' => TRUE, ); $form['title'] = array( '#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -20, ); $categories = load_categories_tree(0,0); $cat_options = generate_categories_options($categories); $fcid = null; if(isset($form_state['values']['category'])){ $fcid = $form_state['values']['category']; }else if (isset($node->fcid)){ $fcid = $node->fcid; } $item_options = array( null => "Vyberte..."); if($fcid != null && $fcid != 0){ $itemy = load_items_tree($fcid); $item_options = generate_items_options($itemy); } $form['category'] = array( '#type' => 'select', '#title' => check_plain($type->category_label), '#required' => TRUE, '#weight' => -4, '#options' => $cat_options, '#default_value' => $fcid ? $fcid : 0, '#ahah' => array( 'path' => 'fileshare/items/js', 'wrapper' => 'items-wrapper', 'effect' => 'fade', 'method' => 'replace', ), ); $form['category_tmp'] = array( '#type' => 'hidden', '#value' => $fcid ? $fcid : 0, ); $form['items'] = array( '#type' => 'select', '#title' => check_plain($type->items_label), '#weight' => -3, '#prefix' => '<div id="items-wrapper">', // This is our wrapper div. '#suffix' => '</div>', '#options' => $item_options, '#required' => TRUE, ); if(isset($form_state['values']['items'])){ $form['items']['#default_value'] = $form_state['values']['items']; }else if (isset($node->fiid) && !isset($form_state['values']['items'])){ $form['items']['#default_value'] = $node->fiid; }else{ unset($form['items']['#default_value']); } $form['body'] = array( '#type' => 'textarea', '#title' => check_plain($type->body_label), '#required' => FALSE, '#default_value' => $node->body, '#weight' => -2, ); return $form; } ?> Jirka
| Příloha | Velikost |
|---|---|
| editace_popisku_typu_obsahu.gif | 11.89 KB |
| manage_fields.gif | 14.01 KB |

Watch, Download porn videos free...
Watch, Download porn videos free...