# b-blocks/2.1.2/build/table-cell/render.php

bBlocks – Essential Gutenberg Blocks &amp; Patterns Collection, version 2.1.2. 76 lines.

- Page: https://pluginprobe.com/plugins/b-blocks/2.1.2/code/build/table-cell/render.php
- Raw: https://pluginprobe.com/plugins/b-blocks/2.1.2/raw/build/table-cell/render.php
- Modified: 2026-08-24T10:46:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/b-blocks/2.1.2/code/build/table-cell/render.php#L10-L20`.

```php
<?php
$id = wp_unique_id( 'bBlocksTableCell-' );
$wrapper_attributes = get_block_wrapper_attributes();
$tagName = in_array( $attributes['tagName'] ?? 'td', [ 'td', 'th' ], true ) ? $attributes['tagName'] : 'td';
$colSpan= $attributes['settings']['colSpan'];
$rowSpan= $attributes['settings']['rowSpan'];
$styles = $attributes['styles'];
$alignment = $styles['alignment'];
$normal = $styles['normal'];
$hover = $styles['hover'];

if ( ! function_exists( 'b_blocks_table_cell_isValidCSS' ) ) {
	function b_blocks_table_cell_isValidCSS($property, $value) {
		if ( empty( $value ) && $value !== '0' && $value !== 0 ) {
			return '';
		}
		return "$property: $value;";
	}

	function b_blocks_table_cell_getBackgroundCSS( $bg, $isSolid = true, $isGradient = true, $isImage = true ) {
		if ( ! is_array( $bg ) ) {
			$bg = array();
		}
		extract( $bg );
		$type = $type ?? 'solid';
		$color = $color ?? '';
		$gradient = $gradient ?? 'linear-gradient(135deg, #0040E3, #18D4FD)';
		$image = $image ?? [];
		$position = $position ?? 'center center';
		$attachment = $attachment ?? '';
		$repeat = $repeat ?? '';
		$size = $size ?? '';
		$overlayColor = $overlayColor ?? '';

		if ( 'gradient' === $type && $isGradient ) {
			$styles = b_blocks_table_cell_isValidCSS('background', $gradient);
		} elseif ( 'image' === $type && $isImage ) {
			$imgUrl = $image['url'] ?? '';
			$styles = "background: url($imgUrl);"
				. b_blocks_table_cell_isValidCSS('background-color', $overlayColor)
				. b_blocks_table_cell_isValidCSS('background-position', $position)
				. b_blocks_table_cell_isValidCSS('background-size', $size)
				. b_blocks_table_cell_isValidCSS('background-repeat', $repeat)
				. b_blocks_table_cell_isValidCSS('background-attachment', $attachment)
				. b_blocks_table_cell_isValidCSS('background-repeat', $repeat)
				. "background-blend-mode: overlay;";
		} else {
			$styles = $isSolid ? b_blocks_table_cell_isValidCSS('background', $color) : '';
		}

		return $styles;
	}
}
?>
<style>
  #<?php echo esc_attr( $id ); ?> {
    <?php
      echo "display:table-cell;";
      echo $alignment? "text-align:" . $alignment['desktop'] . ";": "";
      echo b_blocks_table_cell_getBackgroundCSS($normal['bg']);
      echo $hover['transition']? "transition: background " . $hover['transition'] . "s ease-in-out;": "";
    ?>
  }
  #<?php echo esc_attr( $id ); ?>:hover {
    <?php
    echo b_blocks_table_cell_getBackgroundCSS($hover['bg']);
    ?>
  }

</style>

<<?php echo $tagName; ?> <?php echo wp_kses_post(get_block_wrapper_attributes()); ?> id='<?php echo esc_attr( $id ); ?>' colspan='<?php echo esc_attr( $colSpan ); ?>' rowspan='<?php echo esc_attr( $rowSpan ); ?>'>
  <?php echo $content; ?>
</<?php echo $tagName; ?>>


```
