class-section.php
<?php
namespace HivePress\Blocks;
use HivePress\Helpers as hp;
defined( 'ABSPATH' ) || exit;
class Section extends Container {
protected $title;
public function __construct( $args = [] ) {
$args = hp\merge_arrays(
[
'optional' => true,
],
$args
);
parent::__construct( $args );
}
protected function boot() {
if ( $this->title ) {
$this->header['section_title'] = [
'type' => 'part',
'path' => 'page/section-title',
'context' => [ 'section_title' => $this->title ],
'_order' => 5,
];
}
$this->attributes = hp\merge_arrays(
$this->attributes,
[
'class' => [ 'hp-section' ],
]
);
parent::boot();
}
}