Skip to content

Commit eaf13e3

Browse files
committed
Updated compatibility for Carbon Fields 2.1.1
1 parent a4e76cd commit eaf13e3

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Release changes are noted on the [Releases](https://github.com/dmhendricks/wordp
7979

8080
* Added Carbon Fields [Serialized Datastore](https://github.com/dmhendricks/wordpress-base-plugin/wiki/Features-&-Customization#serialized-data-store) example
8181
* Fixed bugs with example widget scope
82+
* Updated compatibility for Carbon Fields 2.1.1
8283

8384
## Credits
8485

app/Helpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static function get_post_categories($as_slugs = false, $post_id = null) {
158158
* @return string
159159
* @since 0.1.0
160160
*/
161-
public function get_script_version( $script, $return_minified = false, $script_version = null ) {
161+
public static function get_script_version( $script, $return_minified = false, $script_version = null ) {
162162
$version = $script_version ?: self::$config->get( 'plugin/meta/Version' );
163163
if( self::is_production() ) return $version;
164164

@@ -185,9 +185,9 @@ public function get_script_version( $script, $return_minified = false, $script_v
185185
* @return string The URL or path to minified or regular $script.
186186
* @since 0.1.0
187187
*/
188-
public function get_script_path( $script, $return_minified = true, $return_url = false ) {
188+
public static function get_script_path( $script, $return_minified = true, $return_url = false ) {
189189
$script = trim( $script, '/' );
190-
if( $return_minified && strpos( $script, '.' ) && $this->is_production() ) {
190+
if( $return_minified && strpos( $script, '.' ) && self::is_production() ) {
191191
$script_parts = explode( '.', $script );
192192
$script_extension = end( $script_parts );
193193
array_pop( $script_parts );
@@ -204,7 +204,7 @@ public function get_script_path( $script, $return_minified = true, $return_url =
204204
* @param bool
205205
* @since 0.1.0
206206
*/
207-
public function get_script_url( $script, $return_minified = false ) {
207+
public static function get_script_url( $script, $return_minified = false ) {
208208
return self::get_script_path( $script, $return_minified, true );
209209
}
210210

app/Plugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function init() {
6262
}
6363

6464
if( $this->verify_dependencies( 'carbon_fields' ) === true ) {
65-
add_action( 'carbon_fields_loaded', array( $this, 'load_plugin' ));
65+
add_action( 'carbon_fields_fields_registered', array( $this, 'load_plugin' ));
6666
}
6767

6868
}
@@ -206,7 +206,7 @@ public function get_plugin_option( $key, $cache = true ) {
206206
* @return string Prefixed string/field value
207207
* @since 0.2.0
208208
*/
209-
public function prefix( $field_name = null ) {
209+
public static function prefix( $field_name = null ) {
210210
return $field_name !== null ? self::$config->get( 'prefix' ) . $field_name : self::$config->get( 'prefix' );
211211
}
212212

@@ -218,7 +218,7 @@ public function prefix( $field_name = null ) {
218218
* @return bool
219219
* @since 0.1.0
220220
*/
221-
public function is_production() {
221+
public static function is_production() {
222222
return ( !defined( 'WP_ENV' ) || ( defined('WP_ENV' ) && !in_array( WP_ENV, array('development', 'staging') ) ) );
223223
}
224224

app/PostTypes/Clients.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public function add_post_type_client() {
5353

5454
// Add fields
5555
Container::make( 'post_meta', __('Client Details', self::$textdomain ) )
56-
->show_on_post_type( $cpt->postTypeName )
56+
->show_on_post_type( $cpt->name )
5757
->add_fields( array(
5858
Field::make( 'text', $this->prefix( 'name' ), __( 'Name', self::$textdomain ) ),
5959
Field::make( 'text', $this->prefix( 'company' ), __( 'Company', self::$textdomain ) ),
6060
)
6161
);
6262
Container::make( 'post_meta', 'Contact Info' )
63-
->show_on_post_type( $cpt->postTypeName )
63+
->show_on_post_type( $cpt->name )
6464
->add_fields( array(
6565
Field::make( 'text', $this->prefix( 'url' ), __( 'Web Site', self::$textdomain ) ),
6666
Field::make( 'text', $this->prefix( 'phone' ), __( 'Phone Number', self::$textdomain ) ),

app/Settings/Carbon_Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function create_tabbed_options_page() {
113113
*/
114114
private function create_single_options_page() {
115115

116-
Container::make( 'theme_options', self::$config->get( 'plugin/meta/Name' ) )
116+
$container = Container::make( 'theme_options', self::$config->get( 'plugin/meta/Name' ) )
117117
->set_page_parent( 'options-general.php' )
118118
->add_fields( array(
119119
Field::make( 'text', $this->prefix( 'your_name' ), __( 'Your Name', self::$textdomain ) ),

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": ">=5.6.0",
2222
"jjgrainger/posttypes": "dev-master",
23-
"tgmpa/tgm-plugin-activation": "^2.6.0",
23+
"tgmpa/tgm-plugin-activation": "^2.6.1",
2424
"tareq1988/wordpress-settings-api-class": "dev-master",
2525
"dmhendricks/wordpress-toolkit": "dev-master",
2626
"composer/installers": "^1.4.0"

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: hendridm
33
Tags: wordpress,base,plugin,boilerplate,composer,carbonfields
44
Donate link: https://paypal.me/danielhendricks
55
Requires at least: 4.0
6-
Tested up to: 4.8.2
6+
Tested up to: 4.9
77
Stable tag: 0.3.0
88
License: GPL-2.0
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html

0 commit comments

Comments
 (0)