protected function _render_function_callback($row, HTMLTableColumn $column, HTMLTable $table) { $array = $row; $json = HTMLHelper::escape(JSHelper::cast_obj($array)); $block = new HTMLLongTag('div'); $block->add_style('white-space', 'nowrap'); $block->add_style('text-align', 'center'); $block->add_style('padding', '0 10px'); $html = ""; $count_added = 0; /** * * @var $tag HTMLTag * */ foreach ($column->_actions_tags as $index => $tag) { if ($tag->call_filter_callback($row, $column, $table) === false) { continue; } $tag_html = $tag->to_string(); $tag_html = str_replace('%7B%7B', '{{', $tag_html); $tag_html = str_replace('%7D%7D', '}}', $tag_html); if (preg_match(self::$_row_json_pattern, $tag_html, $match)) { $tag_html = preg_replace(self::$_row_json_pattern, $json, $tag_html); } while (preg_match(self::$_row_field_pattern, $tag_html, $match)) { if ($match['field'] == self::ROW_ID_FIELD) { $field = $table->get_row_id($row); } else { $field = ArrayHelper::get_value($row, $match['field']); } $tag_html = str_replace($match[0], JSHelper::cast($field), $tag_html); } if ($count_added > 0) { $html .= ' '; } $html .= $tag_html; $count_added++; } $block->set_content($html); return $block; }
public function call_js_checked_rows_function($field = null) { return $this->get_js_checked_rows_function() . '(' . JSHelper::cast($field) . ')'; }