xowf::WorkflowPage instproc childpage (public)

 <instance of xowf::WorkflowPage[i]> childpage -name name  \
    [ -form form ]

Defined in packages/xowf/tcl/xowf-procs.tcl

Return the child page of the current object with the provided name. In case the child object does not exist, create it as an instance of the provided form.

Switches:
-name
(required)
-form
(optional)
Returns:
page object

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_test_items create_test_items (test xowf) xowf::WorkflowPage instproc childpage xowf::WorkflowPage instproc childpage test_create_test_items->xowf::WorkflowPage instproc childpage

Testcases:
create_test_items
Source code:
if {[info exists form]} {
  set child_page_id [::${:package_id} lookup  -use_package_path false  -default_lang en  -name $name  -parent_id ${:item_id}]
  if {$child_page_id == 0} {
    ns_log notice "child page '$name' does not exist"
    set form_obj [::${:package_id} instantiate_forms  -default_lang "en"  -forms $form]
    if {[llength $form_obj] == 0} {
      error "childpage: cannot instantiate $form"
    }
    set p [$form_obj create_form_page_instance  -name $name  -nls_language en_US  -parent_id ${:item_id}  -package_id ${:package_id}  -instance_attributes {}]
    $p save_new
  } else {
    #ns_log notice "child page '$name' exists already (item_id $child_page_id)"
    set p [::xo::db::CrClass get_instance_from_db -item_id $child_page_id]
  }
  return $p
} else {
  error "cannot create '$name': API supports so far only form pages"
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: