Skip to content

Commit

Permalink
bugfix component slug
Browse files Browse the repository at this point in the history
  • Loading branch information
jerome-barbato committed Jan 18, 2023
1 parent a3f0073 commit a962fbb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions acf-extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/*
Plugin Name: Advanced Custom Fields Extensions
Description: Advanced Custom Fields add on. Create components, component field, hidden field and latest post field
Version: 1.3.0
Version: 1.3.1
Author: Metabolism
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

defined('ABSPATH') or die('No script kiddies please!');

define('ACF_EXTENSIONS_VERSION', '1.3.0');
define('ACF_EXTENSIONS_VERSION', '1.3.1');

/**
* Load up the translation files
Expand Down
32 changes: 20 additions & 12 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
CHANGELOG
---------

##1.2.2
## 1.3.1
#### Bugfix
- slug on component for ACF >= 6

## 1.3.0
#### Feature
- New fields

## 1.2.2
#### Bugfix
- id field, generated uniqid

##1.1.11
## 1.1.11
#### Feature
- added post parent location rule

##1.1.10
## 1.1.10
#### Feature
- added instagram post url

##1.1.9
## 1.1.9
#### Feature
- added id field, generate uniqid

##1.1.8
## 1.1.8
#### Feature
- added fields cleaning function, add ?clean-acf=1 in a backend url

##1.1.7
## 1.1.7
#### Bugfix
- invalid `dynamic_select` component value

##1.1.6
## 1.1.6
#### Feature
- added `dynamic_select` component, list values from other field in post or in options

##1.1.5
## 1.1.5
#### Feature
- Latest post component allow multiple post_type

##1.1.4
## 1.1.4
#### Bugfix
- Allow empty tag

##1.1.3
## 1.1.3
#### Feature
- added `tag` settings to text/textarea to let user choose html tag
- added `public` settings to control entity variable visibility
Expand All @@ -47,10 +55,10 @@ CHANGELOG
#### Bugfix
- Fix post selection when using term template

##1.1.2
## 1.1.2
#### Feature
- added `term template` display rule selector, require a `get_taxonomy_templates` function

##1.1.1
## 1.1.1
#### Bugfix
- fix when Multisite rules equal all
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"metabolism/acf-extensions",
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://www.akhela.fr",
"type": "wordpress-plugin",
"description": "ACF Extensions plugin with components, hidden field, dynamic select, inline micro editor, Instagram post, children and latest posts field",
Expand Down
22 changes: 21 additions & 1 deletion fields/class-acf-field-components.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public function __construct()

// handle slug
add_action('edit_form_before_permalink', array($this, 'acf_extensions_add_slug'));
add_action('acf/render_field_group_settings', array($this, 'acf_extensions_add_slug'));

add_action('wp_insert_post', array($this, 'acf_extensions_update_component'), 10, 3 );

// called the base, no parent, cause we're hacking the repeater
Expand Down Expand Up @@ -760,14 +762,32 @@ protected function fetch_available_field_groups()
* @return void
* @since 1.0.0
*/
public function acf_extensions_add_slug($post) {
public function acf_extensions_add_slug() {

global $post;

if($post->post_type == 'acf-field-group' && $post->post_status == 'acf-component'){

if( defined('ACF_MAJOR_VERSION') && ACF_MAJOR_VERSION > 5 ){

$html =
'<div class="acf-field acf-field-text" data-name="slug" data-type="text" style="max-width: 600px;">'.
'<div class="acf-label">'.
'<label for="acf_field_group-description">'.__( 'Slug' ).'</label></div>'.
'<div class="acf-input">'.
'<div class="acf-input-wrap"><input type="text" id="slug" name="slug" value="'.$post->post_excerpt.'" autocomplete="off"></div></div>'.
'</div>';
}
else{

$html =
'<div class="hide-if-no-js">'.
'<strong>'.__( 'Slug' ).'</strong> '.
'<span id="editable-post-name"><input type="text" name="slug" value="'.$post->post_excerpt.'" autocomplete="off"></span> </span>'.
'<span id="edit-slug-buttons"><button type="submit" class="save button button-small">OK</button></span>'.
'</div>';
}

echo $html;
}
}
Expand Down

0 comments on commit a962fbb

Please sign in to comment.