Pimcore\Model\Object\ClassDefinition\Data\Table::getDiffVersionPreview PHP Method

getDiffVersionPreview() public method

Generates a pretty version preview (similar to getVersionPreview) can be either html or a image URL. See the ObjectMerger plugin documentation for details
public getDiffVersionPreview ( $data, null $object = null, mixed $params = [] ) : array | string
$data
$object null
$params mixed
return array | string
    public function getDiffVersionPreview($data, $object = null, $params = [])
    {
        if ($data) {
            $html = "<table>";
            foreach ($data as $row) {
                $html .= "<tr>";
                if (is_array($row)) {
                    foreach ($row as $cell) {
                        $html .= "<td>";
                        $html .= $cell;
                        $html .= "</th>";
                    }
                }
                $html .= "</tr>";
            }
            $html .= "</table>";
            $value = [];
            $value["html"] = $html;
            $value["type"] = "html";
            return $value;
        } else {
            return "";
        }
    }