I've created a custom content-type called "Books."
I need to create another content type named "Catalogs" which may contain one/many "Books" as its fields.
How would I achieve that? I'd prefer some GUI tool to construct my custom content type, from admin panel, or doing some coding, if necessary.
PS: I found this question asked here but the solution did not help. Can someone provide a detailed answer, please?
EDIT:
MohammadAliAkbari's answer works perfectly :) One problem - When adding "Books" a user can add Books not created by him - he can add any Book to his "Catalog" - How can I add constraints such that a user can add Books only created by him to his Catalog?
Solution:
Using Tenken's answer, I figured out that I can write this code in my module to solve the scenario just mentioned above:
function myModule_form_alter(&$form, &$form_state, $form_id) {
// dsm($form_id); // Use this line to find YOUR-DESIRED-FORM-ID
switch ($form_id) {
case 'YOUR-DESIRED-FORM-ID':
$form['#validate'][] = 'stylesku_add_sku_form_validate';
// dsm($form); // Use this to find out form's elements
global $user;
$currentUser = $user->uid;
$fieldSku = $form['FIELD-ID-OF-BOOK'];
$lang = $fieldSku['#language'];
$fieldOptions = $fieldSku[$lang]['#options'];
foreach($fieldOptions as $nid=>$nodeTitle){
if(!is_int($nid))
continue; // Needed as the first option in select box is not really any book
$nid = (int) $nid;
$n = node_load($nid);
if($n->uid != $currentUser){
// Remove this BOOK, this book was not created by current user
unset($form['FIELD-ID-OF-BOOK'][$lang]['#options'][$nid]);
}
}
break;
}
}