@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'required' => 'Este campo es obligatorio.', |
|
5 | - 'validate' => 'El campo [field] es inválido.', |
|
6 | - 'validate_required' => 'El campo [field] es obligatorio.', |
|
4 | + 'required' => 'Este campo es obligatorio.', |
|
5 | + 'validate' => 'El campo [field] es inválido.', |
|
6 | + 'validate_required' => 'El campo [field] es obligatorio.', |
|
7 | 7 | 'validate_alpha' => 'El campo [field] solo debe contener letras.', |
8 | 8 | 'validate_alpha_dash' => 'El campo [field] solo debe contener letras, números y guiones.', |
9 | 9 | 'validate_alpha_num' => 'El campo [field] solo debe contener letras y números.', |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'required' => 'This field is required.', |
|
5 | - 'validate' => 'The [field] field is invalid.', |
|
6 | - 'validate_required' => 'The [field] field is required.', |
|
4 | + 'required' => 'This field is required.', |
|
5 | + 'validate' => 'The [field] field is invalid.', |
|
6 | + 'validate_required' => 'The [field] field is required.', |
|
7 | 7 | 'validate_alpha' => 'The [field] may only contain letters.', |
8 | 8 | 'validate_alpha_dash' => 'The [field] may only contain letters, numbers, and dashes.', |
9 | 9 | 'validate_alpha_num' => 'The [field] may only contain letters and numbers.', |
@@ -9,52 +9,52 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @var string |
11 | 11 | */ |
12 | - protected $path; |
|
12 | + protected $path; |
|
13 | 13 | |
14 | - /** |
|
14 | + /** |
|
15 | 15 | * Create a new plugin instance. |
16 | 16 | * |
17 | 17 | * @return void |
18 | 18 | */ |
19 | - public function __construct() |
|
20 | - { |
|
21 | - $this->setPath(); |
|
22 | - } |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + $this->setPath(); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * Set the plugin autoload path. |
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function setPath() |
|
30 | - { |
|
31 | - $reflector = new \ReflectionClass($this); |
|
32 | - $this->path = dirname($reflector->getFileName());; |
|
33 | - } |
|
29 | + public function setPath() |
|
30 | + { |
|
31 | + $reflector = new \ReflectionClass($this); |
|
32 | + $this->path = dirname($reflector->getFileName());; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
35 | + /** |
|
36 | 36 | * Get autoload path. |
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function path($append = null) |
|
41 | - { |
|
42 | - return is_null($append) ? $this->path |
|
43 | - : $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/'; |
|
44 | - } |
|
40 | + public function path($append = null) |
|
41 | + { |
|
42 | + return is_null($append) ? $this->path |
|
43 | + : $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/'; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
46 | + /** |
|
47 | 47 | * Get paths to templates. |
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public function templatePaths() |
|
52 | - { |
|
53 | - $path = $this->path('templates'); |
|
54 | - return [$path]; |
|
55 | - } |
|
51 | + public function templatePaths() |
|
52 | + { |
|
53 | + $path = $this->path('templates'); |
|
54 | + return [$path]; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
57 | + /** |
|
58 | 58 | * Trigger an event callback. |
59 | 59 | * - onLoad |
60 | 60 | * - onDefine |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | * - onValid |
67 | 67 | * - onInvalid |
68 | 68 | * |
69 | - * @param \Helmut\Forms\Form $form |
|
70 | - * @param string $name |
|
71 | - * @param array $params |
|
69 | + * @param \Helmut\Forms\Form $form |
|
70 | + * @param string $name |
|
71 | + * @param array $params |
|
72 | 72 | * @return mixed |
73 | 73 | */ |
74 | - public function event($form, $name, $params = []) |
|
75 | - { |
|
76 | - $name = $form->validator()->studly($name); |
|
74 | + public function event($form, $name, $params = []) |
|
75 | + { |
|
76 | + $name = $form->validator()->studly($name); |
|
77 | 77 | |
78 | - if (method_exists($this, 'on'.$name)) { |
|
79 | - return call_user_func_array(array($this, 'on'.$name), [$form, $params]); |
|
80 | - } |
|
78 | + if (method_exists($this, 'on'.$name)) { |
|
79 | + return call_user_func_array(array($this, 'on'.$name), [$form, $params]); |
|
80 | + } |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function setPath() |
30 | 30 | { |
31 | 31 | $reflector = new \ReflectionClass($this); |
32 | - $this->path = dirname($reflector->getFileName());; |
|
32 | + $this->path = dirname($reflector->getFileName()); ; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -471,7 +471,7 @@ |
||
471 | 471 | |
472 | 472 | // Work out the argument names of the requested method |
473 | 473 | $method = new \ReflectionMethod($this, $name); |
474 | - foreach($method->getParameters() as $arg) { |
|
474 | + foreach ($method->getParameters() as $arg) { |
|
475 | 475 | $args[] = $arg->getName(); |
476 | 476 | } |
477 | 477 |
@@ -347,7 +347,9 @@ discard block |
||
347 | 347 | return false; |
348 | 348 | } |
349 | 349 | |
350 | - if (isset($this->errors[$method])) unset($this->errors[$method]); |
|
350 | + if (isset($this->errors[$method])) { |
|
351 | + unset($this->errors[$method]); |
|
352 | + } |
|
351 | 353 | |
352 | 354 | return true; |
353 | 355 | } |
@@ -389,7 +391,9 @@ discard block |
||
389 | 391 | */ |
390 | 392 | public function error($message) |
391 | 393 | { |
392 | - if ( ! isset($this->errors['userDefined'])) $this->errors['userDefined'] = []; |
|
394 | + if ( ! isset($this->errors['userDefined'])) { |
|
395 | + $this->errors['userDefined'] = []; |
|
396 | + } |
|
393 | 397 | |
394 | 398 | $this->errors['userDefined'][] = $message; |
395 | 399 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class Memory extends Plugin { |
8 | 8 | |
9 | - // Protects input from accidental loss |
|
9 | + // Protects input from accidental loss |
|
10 | 10 | // by saving as you type. WIP |
11 | 11 | |
12 | 12 | } |
13 | 13 | \ No newline at end of file |
@@ -6,40 +6,40 @@ |
||
6 | 6 | |
7 | 7 | class Feedback extends Plugin { |
8 | 8 | |
9 | - public function onLoad($form) |
|
10 | - { |
|
11 | - $form->addButton('feedback_trigger_'.$form->id); |
|
12 | - } |
|
9 | + public function onLoad($form) |
|
10 | + { |
|
11 | + $form->addButton('feedback_trigger_'.$form->id); |
|
12 | + } |
|
13 | 13 | |
14 | - public function onSubmitted($form) |
|
15 | - { |
|
16 | - $request = $form->getRequest(); |
|
14 | + public function onSubmitted($form) |
|
15 | + { |
|
16 | + $request = $form->getRequest(); |
|
17 | 17 | |
18 | - if ($request->get('feedback_trigger_'.$form->id)) { |
|
18 | + if ($request->get('feedback_trigger_'.$form->id)) { |
|
19 | 19 | |
20 | - $field = $form->field($request->get('name')); |
|
20 | + $field = $form->field($request->get('name')); |
|
21 | 21 | |
22 | - if ( ! is_null($field)) { |
|
22 | + if ( ! is_null($field)) { |
|
23 | 23 | |
24 | - $field->setFromRequest($request); |
|
25 | - $field->runValidations(); |
|
24 | + $field->setFromRequest($request); |
|
25 | + $field->runValidations(); |
|
26 | 26 | |
27 | - $response = [ |
|
28 | - 'id' => $field->id, |
|
29 | - 'valid' => $field->valid(), |
|
30 | - 'error_id' => 'feedback_errors_'.$field->id, |
|
31 | - 'error' => '', |
|
32 | - ]; |
|
27 | + $response = [ |
|
28 | + 'id' => $field->id, |
|
29 | + 'valid' => $field->valid(), |
|
30 | + 'error_id' => 'feedback_errors_'.$field->id, |
|
31 | + 'error' => '', |
|
32 | + ]; |
|
33 | 33 | |
34 | - if ( ! $field->valid()) { |
|
35 | - $response['error'] = $form->renderFieldErrors($field); |
|
36 | - } |
|
34 | + if ( ! $field->valid()) { |
|
35 | + $response['error'] = $form->renderFieldErrors($field); |
|
36 | + } |
|
37 | 37 | |
38 | - header('Content-Type: application/json'); |
|
39 | - echo json_encode($response); |
|
40 | - exit(); |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
38 | + header('Content-Type: application/json'); |
|
39 | + echo json_encode($response); |
|
40 | + exit(); |
|
41 | + } |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'plugins' => [ |
|
5 | - 'feedback', |
|
6 | - ], |
|
4 | + 'plugins' => [ |
|
5 | + 'feedback', |
|
6 | + ], |
|
7 | 7 | ]; |
8 | 8 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->app->bind('Helmut\Forms\Request', 'Helmut\Forms\Requests\Laravel'); |
|
16 | + $this->app->bind('Helmut\Forms\Request', 'Helmut\Forms\Requests\Laravel'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'validate_min' => 'El tamaño de [field] debe ser de al menos [min].', |
|
5 | - 'validate_max' => 'El campo [field] no debe ser mayor a [max].', |
|
6 | - 'validate_between' => 'El campo [field] tiene que estar entre [min] - [max].', |
|
4 | + 'validate_min' => 'El tamaño de [field] debe ser de al menos [min].', |
|
5 | + 'validate_max' => 'El campo [field] no debe ser mayor a [max].', |
|
6 | + 'validate_between' => 'El campo [field] tiene que estar entre [min] - [max].', |
|
7 | 7 | ]; |
8 | 8 | \ No newline at end of file |