-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- feat(blocks): Generate blocks with InnerBlock support when using compatible ACF versions (Fixes #16) - enhance(partials): Optimize conditional order for partials
- Loading branch information
Showing
5 changed files
with
122 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Log1x\AcfComposer\Block; | ||
use StoutLogic\AcfBuilder\FieldsBuilder; | ||
|
||
class DummyClass extends Block | ||
{ | ||
/** | ||
* The block name. | ||
* | ||
* @var string | ||
*/ | ||
public $name = 'DummyClass'; | ||
|
||
/** | ||
* The block description. | ||
* | ||
* @var string | ||
*/ | ||
public $description = 'Lorem ipsum...'; | ||
|
||
/** | ||
* The block category. | ||
* | ||
* @var string | ||
*/ | ||
public $category = 'common'; | ||
|
||
/** | ||
* The block icon. | ||
* | ||
* @var string|array | ||
*/ | ||
public $icon = 'star-half'; | ||
|
||
/** | ||
* The block features. | ||
* | ||
* @var array | ||
*/ | ||
public $supports = [ | ||
'__experimental_jsx' => true, | ||
'mode' => false, | ||
]; | ||
|
||
/** | ||
* Data to be passed to the block before rendering. | ||
* | ||
* @return array | ||
*/ | ||
public function with() | ||
{ | ||
return [ | ||
'items' => $this->items(), | ||
]; | ||
} | ||
|
||
/** | ||
* The block field group. | ||
* | ||
* @return array | ||
*/ | ||
public function fields() | ||
{ | ||
$DummyCamel = new FieldsBuilder('DummySnake'); | ||
|
||
$DummyCamel | ||
->addRepeater('items') | ||
->addText('item') | ||
->endRepeater(); | ||
|
||
return $DummyCamel->build(); | ||
} | ||
|
||
/** | ||
* Return the items field. | ||
* | ||
* @return array | ||
*/ | ||
public function items() | ||
{ | ||
return get_field('items') ?: []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@if ($items) | ||
<ul> | ||
@foreach ($items as $item) | ||
<li>{{ $item['item'] }}</li> | ||
@endforeach | ||
</ul> | ||
@else | ||
<p>No items found!</p> | ||
@endif | ||
|
||
<InnerBlock /> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
I believe this is supposed to be
<InnerBlocks />
.(Missing 's')