Created
March 7, 2017 11:31
-
-
Save cgi-caesar/dc0363c08150d0ae0dbade6e1c64f339 to your computer and use it in GitHub Desktop.
aMember (site.php): How to add new columns to grids in admin interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Am_Di::getInstance()->hook->add('gridProductInitGrid', function(Am_Event_Grid $e) { | |
$e->getGrid()->addField('comment', ___('Comment')); | |
$e->getGrid()->addField('start_date', ___('Start Date Calculation')) | |
->setGetFunction(function($record, $grid, $fieldname, $field){ | |
$r = explode(',', $record->{$fieldname}); | |
foreach ($r as $k => $v) { | |
if ($v == 'group' && $record->renewal_group) { | |
$r[$k] = sprintf('group (%s)', $record->renewal_group); | |
} | |
if ($v == 'fixed') { | |
$r[$k] = sprintf('fixed (%s)', $record->start_date_fixed); | |
} | |
} | |
return implode(', ', $r); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment