Bureaucrats, emailconfirmed, Administrators
825
edits
| Line 26: | Line 26: | ||
[[Display page have to include :]] | [[Display page have to include :]] | ||
<source lang="php"> | |||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; | ||
</source> | |||
[[Load extrafield array in object :]] | [[Load extrafield array in object :]] | ||
<source lang="php"> | |||
$extrafields = new ExtraFields($db); | $extrafields = new ExtraFields($db); | ||
$extralabels=$extrafields->fetch_name_optionals_label('''ObjectClassName'''); | $extralabels=$extrafields->fetch_name_optionals_label('''ObjectClassName'''); | ||
</source> | |||
[[Load extrafield into object :]] | [[Load extrafield into object :]] | ||
<source lang="php"> | |||
''$object''->fetch($rowid); | ''$object''->fetch($rowid); | ||
''$object''->fetch_optionals($rowid,$extralabels); | ''$object''->fetch_optionals($rowid,$extralabels); | ||
</source> | |||
[[Before call ''$object''->create or ''$object''->delete :]] | [[Before call ''$object''->create or ''$object''->delete :]] | ||
<source lang="php"> | |||
$ret = $extrafields->setOptionalsFromPost($extralabels,''$object''); | $ret = $extrafields->setOptionalsFromPost($extralabels,''$object''); | ||
</source> | |||
[[Inside edit page to display extrafields :]] | [[Inside edit page to display extrafields :]] | ||
<source lang="php"> | |||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook | $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook | ||
if (empty($reshook) && ! empty($extrafields->attribute_label)) | if (empty($reshook) && ! empty($extrafields->attribute_label)) | ||
| Line 46: | Line 54: | ||
print ''$object''->showOptionals($extrafields,'edit'); | print ''$object''->showOptionals($extrafields,'edit'); | ||
} | } | ||
</source> | |||
[[Inside view page to display extrafields :]] | [[Inside view page to display extrafields :]] | ||
<source lang="php"> | |||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook | $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook | ||
if (empty($reshook) && ! empty($extrafields->attribute_label)) | if (empty($reshook) && ! empty($extrafields->attribute_label)) | ||
| Line 54: | Line 63: | ||
print ''$object''->showOptionals($extrafields); | print ''$object''->showOptionals($extrafields); | ||
} | } | ||
</source> | |||