index.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kubio\Blocks; |
| 4 | use Kubio\Core\Blocks\BlockBase; |
| 5 | use Kubio\Core\Registry; |
| 6 | |
| 7 | class TextBlock extends BlockBase { |
| 8 | |
| 9 | const TEXT = 'text'; |
| 10 | |
| 11 | public function mapPropsToElements() { |
| 12 | $content = $this->getBlockInnerHtml(); |
| 13 | $isLead = $this->getProp( 'isLead' ); |
| 14 | $dropCap = $this->getProp( 'dropCap' ); |
| 15 | $classes = array(); |
| 16 | if ( $isLead ) { |
| 17 | $classes[] = 'h-lead'; |
| 18 | } |
| 19 | if ( $dropCap ) { |
| 20 | $classes[] = 'has-drop-cap'; |
| 21 | } |
| 22 | return array( |
| 23 | self::TEXT => array( |
| 24 | 'className' => $classes, |
| 25 | 'innerHTML' => $content, |
| 26 | ), |
| 27 | ); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | |
| 32 | Registry::registerBlock( __DIR__, TextBlock::class ); |
| 33 |