88use RuntimeException ;
99use StarterKit \App ;
1010use StarterKit \Error \ErrorHandler ;
11- use StarterKit \Helper \Config ;
12- use StarterKit \Exception \ConfigEntryNotFoundException ;
1311use StarterKit \Helper \Utils ;
1412use Throwable ;
1513
@@ -46,9 +44,6 @@ abstract class BlockAbstract implements BlockInterface
4644 * Runs on 'init' hook
4745 *
4846 * @param $blockName
49- *
50- * @throws ConfigEntryNotFoundException
51- * @throws Throwable
5247 */
5348 public function __construct ($ blockName )
5449 {
@@ -70,13 +65,11 @@ public function __construct($blockName)
7065 * Add your server side render callback into $this->blockArgs
7166 *
7267 * @return void
73- *
74- * @throws ConfigEntryNotFoundException
7568 */
7669 public function registerBlock (): void
7770 {
7871 register_block_type_from_metadata (
79- Config:: get ( ' blocksDir ' ) . $ this ->blockName ,
72+ SK_BLOCKS_DIR . $ this ->blockName ,
8073 $ this ->blockArgs
8174 );
8275 }
@@ -91,13 +84,12 @@ public function registerBlock(): void
9184 *
9285 * @return string
9386 *
94- * @throws ConfigEntryNotFoundException
9587 * @throws Throwable
9688 */
9789 public function loadBlockView (string $ file = '' , array $ data = [], string $ base = null , bool $ echo = false ): string
9890 {
9991 if ($ base === null ) {
100- $ base = Config:: get ( ' blocksDir ' ) . $ this ->blockName . '/ ' . Config:: get ( ' blocksViewDir ' ) ;
92+ $ base = SK_BLOCKS_DIR . $ this ->blockName . '/ ' . SK_BLOCKS_VIEW_DIR ;
10193 }
10294
10395 $ viewFilePath = $ base . $ file . '.php ' ;
@@ -191,14 +183,11 @@ public function generateSpacersClasses(array $spacers): array
191183 * Use $blockAssets property instead
192184 *
193185 * @return void
194- *
195- * @throws ConfigEntryNotFoundException
196- * @throws Throwable
197186 */
198187 public function registerBlockAssets (): void
199188 {
200- $ blockUri = Config:: get ( ' blocksUri ' ) . $ this ->blockName . '/build/ ' ;
201- $ blockDir = Config:: get ( ' blocksDir ' ) . $ this ->blockName . '/build/ ' ;
189+ $ blockUri = SK_BLOCKS_URI . $ this ->blockName . '/build/ ' ;
190+ $ blockDir = SK_BLOCKS_DIR . $ this ->blockName . '/build/ ' ;
202191
203192 foreach ($ this ->blockAssets as $ type => $ asset ) {
204193 if (empty ($ asset ['file ' ])) {
@@ -212,7 +201,7 @@ public function registerBlockAssets(): void
212201 * Filter block asset dependencies
213202 */
214203 $ deps = apply_filters (
215- Config:: get ( ' hooksPrefix ' ) . '/block_asset_dependencies ' ,
204+ SK_HOOKS_PREFIX . '/block_asset_dependencies ' ,
216205 $ asset ['dependencies ' ],
217206 $ this ->blockName ,
218207 $ type
0 commit comments