';
} else if (Table::$lastRow != $attributes['row']) {
$pre = '
';
Table::$lastRow = $attributes['row'];
}
$colspan = isset($attributes['colspan']) ? $attributes['colspan'] : 1;
$rowspan = isset($attributes['rowspan']) ? $attributes['rowspan'] : 1;
$attrs_str = '';
$classes = 'tableberg-v-align-'.$attributes['vAlign'];
// Add colspan attribute if it's greater than 1
if ($colspan > 1) {
$attrs_str .= ' colspan="' . esc_attr($colspan) . '"';
}
// Add rowspan attribute if it's greater than 1
if ($rowspan > 1) {
$attrs_str .= ' rowspan="' . esc_attr($rowspan) . '"';
}
$tagName = isset($attributes['tagName']) ? $attributes['tagName'] : 'td';
$content = HtmlUtils::append_attr_value($content, $tagName, ' '.$classes, 'class');
$content = HtmlUtils::add_attrs_to_tag($content, $tagName, $attrs_str);
return $pre . $content . $post;
}
/**
* Register the block.
*/
public function block_registration()
{
$defaults = new \Tableberg\Defaults();
register_block_type(
TABLEBERG_DIR_PATH . 'build/cell/block.json',
array(
'attributes' => $defaults->get_default_attributes('tableberg/cell'),
'render_callback' => array($this, 'render_tableberg_cell_block'),
)
);
}
}