Skip to content

Instantly share code, notes, and snippets.

@aqualad
Last active December 17, 2015 21:19
Show Gist options
  • Save aqualad/5674082 to your computer and use it in GitHub Desktop.
Save aqualad/5674082 to your computer and use it in GitHub Desktop.
onEdit Anonymous Function
<?php
/*
onEdit:
1. Clear the form
2. Select query for the CustomerID on invoices table
3. Call WebCRM::populateControls()
4. Call a method named populateItemList($invoice_id)
4a) populateItemList() should query the invoice_lines table where InvoiceID = $invoice_id
4b) It should then iterate through the results and create the controls for each row (ctlLabel x5, ctlLinkButton x2)
*/
$buildlabels = function($defs) {
$ctls = [];
foreach($defs as $def)
$ctls[] = new ctlLabel($this, [
'type' => 'ctlLabel',
'name' => $def['name'],
'class' => 'BoldLabel',
'style' => ...
'properties' => ['text' => $def['text']
], $this->controls['product_list']
);
return $ctls;
};
$labels = $buildlabels( [
['name'] => 'invoicdeproduct.$ctr',
['text'] => 'assdfasdf',
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment