Dear all. I'm trying to push HTML code into a grid field editing site.php file. It works but the code is escaped when rendered. This is the method I used: $newColumn = $e->getGrid()->addField(new Am_Grid_Field("Usage", "Usage", false)) ->setGetFunction(function($record, $grid, $fieldname, $field){ $columnCode = "Some code..."; return $columnCode; }); I also tried to replace some arbitrary placeholders, like this... Am_Di::getInstance()->hook->add(Am_Event::AFTER_RENDER, function (Am_Event_AfterRender $event) { if (preg_match('#/URL.*#i', $_SERVER['REQUEST_URI'])) { $event->replace('#PLACEHOLDER_CODE#i', "<span class=\"myClass\">Activities</span>"); } } ...with no success. It works only for the first page (I'm working on Browse Users page). When I click on "next" or manually search for something, the AFTER_RENDER event is not called anymore. How can I push HTML inside a field, as it is, without code replacements? Thanks in advance
I got it! I had to use the function setRenderFunction. Here is the code: $newColumn->setRenderFunction(function($record, $fieldname, $grid, $field){ $columnCode = ""; return $grid->renderTd($columnCode, false); // false turns off the escape function. }); Watch out the order of the parameters because it is different compared to setGetFunction. Best regards!