Skip to content

Commit

Permalink
Release 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Oct 28, 2019
1 parent dfd09dc commit d8300ff
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 7.1.0 (released 2019-10-28)

- Added prepend and append methods

## 7.0.0 (released 2019-10-19)

- Added new field classes API
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "7.0-dev"
"dev-master": "7.1-dev"
}
},
"autoload": {
Expand Down
46 changes: 46 additions & 0 deletions src/Fields/Attributes/Pending.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace WordPlate\Acf\Fields\Attributes;

/**
* This is the pending trait.
*
* @author Vincent Klaiber <[email protected]>
*/
trait Pending
{
/**
* Append before the input.
*
* @return self
*/
public function append(string $value): self
{
$this->config->set('append', $value);

return $this;
}

/**
* Prepend before the input.
*
* @return self
*/
public function prepend(string $value): self
{
$this->config->set('prepend', $value);

return $this;
}
}
3 changes: 2 additions & 1 deletion src/Fields/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use WordPlate\Acf\Fields\Attributes\ConditionalLogic;
use WordPlate\Acf\Fields\Attributes\Instructions;
use WordPlate\Acf\Fields\Attributes\Pending;
use WordPlate\Acf\Fields\Attributes\Placeholder;
use WordPlate\Acf\Fields\Attributes\Required;
use WordPlate\Acf\Fields\Attributes\Wrapper;
Expand All @@ -26,7 +27,7 @@
*/
class Email extends Field
{
use Instructions, ConditionalLogic, Placeholder, Required, Wrapper;
use Instructions, ConditionalLogic, Pending, Placeholder, Required, Wrapper;

/**
* The field type.
Expand Down
3 changes: 2 additions & 1 deletion src/Fields/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use WordPlate\Acf\Fields\Attributes\ConditionalLogic;
use WordPlate\Acf\Fields\Attributes\Instructions;
use WordPlate\Acf\Fields\Attributes\MinMax;
use WordPlate\Acf\Fields\Attributes\Pending;
use WordPlate\Acf\Fields\Attributes\Placeholder;
use WordPlate\Acf\Fields\Attributes\Required;
use WordPlate\Acf\Fields\Attributes\Step;
Expand All @@ -28,7 +29,7 @@
*/
class Number extends Field
{
use ConditionalLogic, Instructions, MinMax, Placeholder, Step, Required, Wrapper;
use ConditionalLogic, Instructions, MinMax, Pending, Placeholder, Step, Required, Wrapper;

/**
* The field type.
Expand Down
3 changes: 2 additions & 1 deletion src/Fields/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use WordPlate\Acf\Fields\Attributes\ConditionalLogic;
use WordPlate\Acf\Fields\Attributes\Instructions;
use WordPlate\Acf\Fields\Attributes\Pending;
use WordPlate\Acf\Fields\Attributes\Placeholder;
use WordPlate\Acf\Fields\Attributes\Required;
use WordPlate\Acf\Fields\Attributes\Wrapper;
Expand All @@ -26,7 +27,7 @@
*/
class Password extends Field
{
use ConditionalLogic, Instructions, Placeholder, Required, Wrapper;
use ConditionalLogic, Instructions, Pending, Placeholder, Required, Wrapper;

/**
* The field type.
Expand Down
3 changes: 2 additions & 1 deletion src/Fields/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use WordPlate\Acf\Fields\Attributes\ConditionalLogic;
use WordPlate\Acf\Fields\Attributes\Instructions;
use WordPlate\Acf\Fields\Attributes\MinMax;
use WordPlate\Acf\Fields\Attributes\Pending;
use WordPlate\Acf\Fields\Attributes\Required;
use WordPlate\Acf\Fields\Attributes\Step;
use WordPlate\Acf\Fields\Attributes\Wrapper;
Expand All @@ -27,7 +28,7 @@
*/
class Range extends Field
{
use ConditionalLogic, Instructions, MinMax, Step, Required, Wrapper;
use ConditionalLogic, Instructions, MinMax, Step, Pending, Required, Wrapper;

/**
* The field type.
Expand Down
3 changes: 2 additions & 1 deletion src/Fields/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use WordPlate\Acf\Fields\Attributes\ConditionalLogic;
use WordPlate\Acf\Fields\Attributes\Instructions;
use WordPlate\Acf\Fields\Attributes\Pending;
use WordPlate\Acf\Fields\Attributes\Placeholder;
use WordPlate\Acf\Fields\Attributes\Required;
use WordPlate\Acf\Fields\Attributes\Wrapper;
Expand All @@ -26,7 +27,7 @@
*/
class Text extends Field
{
use ConditionalLogic, Instructions, Placeholder, Required, Wrapper;
use ConditionalLogic, Instructions, Pending, Placeholder, Required, Wrapper;

/**
* The field type.
Expand Down
12 changes: 12 additions & 0 deletions tests/Fields/TextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,16 @@ public function testConditionalLogic()
$this->assertSame('==empty', $field['conditional_logic'][0][0]['operator']);
$this->assertSame('==contains', $field['conditional_logic'][1][0]['operator']);
}

public function testPrepend()
{
$field = Text::make('Prepend')->prepend('prefix')->toArray();
$this->assertSame('prefix', $field['prepend']);
}

public function testAppend()
{
$field = Text::make('Append')->append('suffix')->toArray();
$this->assertSame('suffix', $field['append']);
}
}

0 comments on commit d8300ff

Please sign in to comment.