-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrap.php
75 lines (57 loc) · 1.91 KB
/
Bootstrap.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
<?php
namespace WCM\AstroFields\Examples\Comments;
/**
* Plugin Name: (WCM) AstroFields Comments Example
* Description: Comment form fields example plugin
*/
// Composer autoloader
if ( file_exists( __DIR__."/vendor/autoload.php" ) )
require_once __DIR__."/vendor/autoload.php";
use WCM\AstroFields\Core\Mediators\Entity;
use WCM\AstroFields\PublicForm\Receivers\Label;
use WCM\AstroFields\PublicForm\Templates\LabelTmpl;
use WCM\AstroFields\PublicForm\Views\LabelView;
use WCM\AstroFields\Standards\Templates\InputFieldTmpl;
use WCM\AstroFields\Standards\Templates\TextareaFieldTmpl;
use WCM\AstroFields\Comments\Commands\CommentViewCmd;
add_action( 'comment_form_before_fields', function()
{
$author_label = new CommentViewCmd;
$author_label
->setView( new LabelView )
->setProvider( new Label )
->setTemplate( new LabelTmpl );
$author_view = new CommentViewCmd;
$author_view->setTemplate( new InputFieldTmpl );
$author_field = new Entity( 'comment_form_field_author' );
$author_field
->attach( $author_label, array(
'proxy' => array( 'author', ),
'label' => 'Hello!',
) )
->attach( $author_view, array(
'proxy' => array( 'author', ),
'default' => 'Hello!',
) );
$email_view = new CommentViewCmd;
$email_view->setTemplate( new InputFieldTmpl );
$email_field = new Entity( 'comment_form_field_email' );
$email_field->attach( $email_view, array(
'proxy' => array( 'email', ),
'default' => 'Email',
) );
$url_view = new CommentViewCmd;
$url_view->setTemplate( new InputFieldTmpl );
$url_field = new Entity( 'comment_form_field_url' );
$url_field->attach( $url_view, array(
'proxy' => array( 'url', ),
'default' => 'URL',
) );
$comment_view = new CommentViewCmd;
$comment_view->setTemplate( new TextareaFieldTmpl );
$comment_field = new Entity( 'comment_form_field_comment' );
$comment_field
->attach( $comment_view, array(
'proxy' => array( 'comment', ),
) );
} );