Skip to content

Commit

Permalink
enhance(deps): Add support for doctrine/inflector ^2.0
Browse files Browse the repository at this point in the history
enhance(traits): Move inflector singularize to a trait
  • Loading branch information
Log1x committed Jul 1, 2020
1 parent 9c731fd commit d2edd23
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 64 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"description": "An Advanced Custom Field Configuration Builder",
"require": {
"php": ">=5.4.0",
"doctrine/inflector": "^1.1",
"doctrine/instantiator": "^1.0"
"doctrine/inflector": "^1.1|^2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*",
Expand Down
185 changes: 129 additions & 56 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/FlexibleContentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace StoutLogic\AcfBuilder;

use Doctrine\Common\Inflector\Inflector;

/**
* Create a configuration array for an ACF Flexible Content field.
* A flexible content field can have many different `layouts` which are
* groups of fields.
*/
class FlexibleContentBuilder extends FieldBuilder
{
use Traits\CanSingularize;

/**
* @var array
*/
Expand Down Expand Up @@ -145,6 +145,6 @@ public function getLayouts()
*/
private function getDefaultButtonLabel()
{
return 'Add '.Inflector::singularize($this->getLabel());
return 'Add ' . $this->singularize($this->getLabel());
}
}
Loading

0 comments on commit d2edd23

Please sign in to comment.