# tableberg/0.0.2/includes/Defaults.php

Tableberg – Simple Gutenberg Table Block, version 0.0.2. 194 lines.

- Page: https://pluginprobe.com/plugins/tableberg/0.0.2/code/includes/Defaults.php
- Raw: https://pluginprobe.com/plugins/tableberg/0.0.2/raw/includes/Defaults.php
- Modified: 2023-12-11T17:26:52+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/tableberg/0.0.2/code/includes/Defaults.php#L10-L20`.

```php
<?php
/**
 * Default Attributes
 *
 * @package Tableberg
 */

namespace Tableberg;

/**
 * Handles default attributes of blocks.
 */
class Defaults {

	/**
	 * Default Block Attributes
	 *
	 * @var array Block Attributes
	 */
	public $default_values = array(
		'tableberg/table' => array(
			'attributes' => array(
				'rows'                     => array(
					'type'    => 'number',
					'default' => 2,
				),
				'cellPadding'              => array(
					'type'    => 'array',
					'default' => array(),
				),
				'cols'                     => array(
					'type'    => 'number',
					'default' => 2,
				),
				'hasTableCreated'          => array(
					'type'    => 'boolean',
					'default' => false,
				),
				'enableTableHeader'        => array(
					'type'    => 'boolean',
					'default' => false,
				),
				'enableTableFooter'        => array(
					'type'    => 'boolean',
					'default' => false,
				),
				'tableWidth'               => array(
					'type'    => 'string',
					'default' => '',
				),
				'tableAlignment'           => array(
					'type'    => 'string',
					'default' => 'center',
				),
				'headerBackgroundColor'    => array(
					'type'    => 'string',
					'default' => null,
				),
				'evenRowBackgroundColor'   => array(
					'type'    => 'string',
					'default' => null,
				),
				'oddRowBackgroundColor'    => array(
					'type'    => 'string',
					'default' => null,
				),
				'footerRowBackgroundColor' => array(
					'type'    => 'string',
					'default' => null,
				),
				'tableBorder'              => array(
					'type'    => 'object',
					'default' => array(),
				),
				'innerBorder'              => array(
					'type'    => 'object',
					'default' => array(),
				),
				'enableInnerBorder'        => array(
					'type'    => 'boolean',
					'default' => true,
				),
			),
		),
		'tableberg/cell'  => array(
			'attributes' => array(
				'vAlign' => array(
					'type'    => 'string',
					'default' => 'center',
				),
			),
		),
		'tableberg/row'   => array(
			'attributes' => array(
				'tagName'  => array(
					'type'    => 'string',
					'default' => 'tr',
				),
				'isHeader' => array(
					'type'    => 'boolean',
					'default' => false,
				),
				'isFooter' => array(
					'type'    => 'boolean',
					'default' => false,
				),
			),
		),
		'tableberg/image' => array(
			'attributes' => array(
				'media'           => array(
					'type'    => 'object',
					'default' => array(),
				),
				'height'          => array(
					'type'    => 'string',
					'default' => '',
				),
				'width'           => array(
					'type'    => 'string',
					'default' => '',
				),
				'alt'             => array(
					'type'    => 'string',
					'default' => '',
				),
				'aspectRatio'     => array(
					'type'    => 'string',
					'default' => '',
				),
				'scale'           => array(
					'type'    => 'string',
					'default' => '',
				),
				'sizeSlug'        => array(
					'type'    => 'string',
					'default' => 'large',
				),
				'caption'         => array(
					'type'    => 'string',
					'default' => '',
				),
				'href'            => array(
					'type'    => 'string',
					'default' => '',
				),
				'linkClass'       => array(
					'type'    => 'string',
					'default' => '',
				),
				'linkDestination' => array(
					'type'    => 'string',
					'default' => '',
				),
				'rel'             => array(
					'type'    => 'string',
					'default' => '',
				),
				'linkTarget'      => array(
					'type'    => 'string',
					'default' => '',
				),
				'border'          => array(
					'type'    => 'object',
					'default' => array(),
				),
				'borderRadius'    => array(
					'type'    => 'object',
					'default' => array(),
				),
			),
		),
	);


	/**
	 * Constructor
	 *
	 * @return void
	 */
	public function __construct() {
	}

	/**
	 * Get block default attributes with block name.
	 *
	 * @param string $block_name block name.
	 * @return array block attributes
	 */
	public function get_default_attributes( $block_name ) {
		return $this->default_values[ $block_name ]['attributes'];
	}
}

```
