index.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kubio\Blocks; |
| 4 | |
| 5 | use Kubio\Core\Registry; |
| 6 | use IlluminateAgnostic\Arr\Support\Arr; |
| 7 | |
| 8 | class ReadMorebuttonBlock extends ButtonBlock { |
| 9 | |
| 10 | |
| 11 | public function mapPropsToElements() { |
| 12 | $current_map = parent::mapPropsToElements(); |
| 13 | |
| 14 | $post_id = Arr::get( $this->block_context, 'postId', 0 ); |
| 15 | $current_map[ ButtonBlock::LINK ] = array( |
| 16 | 'href' => esc_url( get_permalink( $post_id ) ), |
| 17 | 'typeOpenLink' => 'sameWindow', |
| 18 | 'noFollow' => false, |
| 19 | 'lightboxMedia' => '', |
| 20 | ); |
| 21 | |
| 22 | return $current_map; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | Registry::registerBlock( |
| 27 | __DIR__, |
| 28 | ReadMorebuttonBlock::class, |
| 29 | array( |
| 30 | 'metadata' => '../button/block.json', |
| 31 | 'metadata_mixins' => array( './block.json' ), |
| 32 | 'mixins_exact_replace' => array( |
| 33 | './block.json' => array( |
| 34 | 'supports.kubio.template', |
| 35 | ), |
| 36 | ), |
| 37 | ) |
| 38 | ); |
| 39 |