-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-sample.php
78 lines (72 loc) · 1.96 KB
/
class-sample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Contains Somoscuatro\Starter_Theme\BLocks\Sample\Sample Class.
*
* @package sc-starter-theme
*/
declare(strict_types=1);
namespace Somoscuatro\Starter_Theme\Blocks\Sample;
use Somoscuatro\Starter_Theme\Blocks\Block;
/**
* Block Main Functionality.
*/
class Sample extends Block {
/**
* The Prefix Used for ACF Blocks.
*
* @var string
*/
public static $acf_block_prefix = 'block_sample';
/**
* Gets the ACF Block Fields.
*
* @return array The ACF Block Fields.
*/
public function get_acf_fields(): array {
return array(
'key' => 'group_' . static::$acf_block_prefix,
'title' => __( 'Block: Sample', 'sc-starter-theme' ),
'fields' => array(
array(
'key' => 'field_' . self::$acf_block_prefix . '_image',
'label' => __( 'Image', 'sc-starter-theme' ),
'name' => self::$acf_block_prefix . '_image',
'type' => 'image',
),
array(
'key' => 'field_' . static::$acf_block_prefix . '_heading',
'label' => __( 'Heading', 'sc-starter-theme' ),
'name' => static::$acf_block_prefix . '_heading',
'type' => 'text',
'required' => 1,
'return_format' => 'string',
),
array(
'key' => 'field_' . static::$acf_block_prefix . '_text',
'label' => __( 'Text', 'sc-starter-theme' ),
'name' => static::$acf_block_prefix . '_text',
'type' => 'wysiwyg',
'required' => 1,
'return_format' => 'string',
),
array(
'key' => 'field_' . static::$acf_block_prefix . '_button',
'label' => __( 'Button', 'sc-starter-theme' ),
'name' => static::$acf_block_prefix . '_button',
'type' => 'link',
'required' => 1,
'return_format' => 'string',
),
),
'location' => array(
array(
array(
'param' => 'block',
'operator' => '==',
'value' => 'acf/sample',
),
),
),
);
}
}