Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Supports nested flexible content fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jameelmoses committed Apr 6, 2020
1 parent 9bb845f commit ac06c9d
Show file tree
Hide file tree
Showing 8 changed files with 964 additions and 777 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog ##

## 1.0.2 - 6 Apr 2020
* Supports nested flexible content fields
* Updating dependencies

## 1.0.1 - 2 Dec 2019
* Resolving jQuery bug in WP 5.3

Expand Down
4 changes: 2 additions & 2 deletions acf-flexible-content-preview.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Flexible Content Preview for Advanced Custom Fields
Version: 1.0.1
Version: 1.0.2
Plugin URI: https://github.com/jameelmoses/acf-flexible-content-preview
Description: Transforms ACF's flexible content field's layout list into a modal with image previews.
Author: Jameel Moses
Expand Down Expand Up @@ -34,7 +34,7 @@
}

// Plugin constants
define( 'FCP_VERSION', '1.0.1' );
define( 'FCP_VERSION', '1.0.2' );
define( 'FCP_MIN_PHP_VERSION', '5.6' );

// Plugin URL and PATH
Expand Down
13 changes: 13 additions & 0 deletions classes/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ public function retrieve_flexible_keys() {
}
$keys[ $layout_field['key'] ] = $layout_field['name'];
}

// One level of recursion to find child flexible content fields
$sub_fields = (array) acf_get_fields( $layout_field );
foreach( $sub_fields as $sub_field ) {
if( 'flexible_content' === $sub_field['type'] ) {
foreach( $sub_field['layouts'] as $layout_sub_field ) {
if ( ! empty( $keys [ $layout_sub_field['key'] ] ) ) {
continue;
}
$keys[ $layout_sub_field['key'] ] = $layout_sub_field['name'];
}
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jameelmoses/acf-flexible-content-preview",
"version": "1.0.1",
"version": "1.0.2",
"description": "Transforms ACF's flexible content field's layout list into a modal with image previews.",
"keywords": [
"ACF",
Expand Down
6 changes: 4 additions & 2 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import gulp from 'gulp';
const $ = require('gulp-load-plugins')();
import sass from 'gulp-sass';
import postcss from 'gulp-postcss';
import del from 'del';
import autoprefixer from 'autoprefixer';

gulp.task('clean', () => del(['assets/css/acf-flexible-content-preview.css']));

gulp.task('sass', () => gulp.src('assets/scss/acf-flexible-content-preview.scss')
.pipe($.sass({
.pipe(sass({
outputStyle: 'expanded',
errLogToConsole: true
}))
.pipe($.postcss([
.pipe(postcss([
autoprefixer({
cascade: false,
grid: true
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "acf-flexible-content-preview",
"description": "Transforms ACF's flexible content field's layout list into a modal with image previews.",
"version": "1.0.1",
"version": "1.0.2",
"main": "gulpfile.babel.js",
"keywords": [
"ACF",
Expand All @@ -18,14 +18,12 @@
],
"license": "GPL-3.0+",
"devDependencies": {
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/register": "^7.7.4",
"autoprefixer": "^9.7.3",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/register": "^7.9.0",
"autoprefixer": "^9.7.5",
"del": "^5.1.0",
"fixme": "^0.5.0",
"gulp": "^4.0.2",
"gulp-load-plugins": "^2.0.1",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.0.2"
},
Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: jameelmoses
Donate link: http://paypal.me/jameelmoses
Tags: acf, advanced, custom, field, fields, addon, flexible, content, preview
Requires at least: 4.7.0
Requires PHP: 5.4
Tested up to: 5.3
Stable tag: 1.0.1
Requires PHP: 5.6
Tested up to: 5.4
Stable tag: 1.0.2
License: GPLv3 or later
License URI: https://github.com/jameelmoses/acf-flexible-content-preview/blob/master/LICENSE.md

Expand Down Expand Up @@ -66,6 +66,12 @@ From your WordPress dashboard

== Changelog ==

= 1.0.2 =
*Release Date - 6 Apr 2020*

* Supporting nested flexible content fields
* Updating dependencies

= 1.0.1 =
*Release Date - 2 Dec 2019*

Expand Down
Loading

0 comments on commit ac06c9d

Please sign in to comment.