Coder Social home page Coder Social logo

beapi / bea-beautiful-flexible Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 1.0 2.57 MB

Transform ACF's flexible layouts list into a nice and UX popup.

Home Page: https://wordpress.org/plugins/bea-beautiful-flexible

License: Other

PHP 78.83% CSS 12.70% JavaScript 8.47%
acf acf-addon wordpress wordpress-plugin

bea-beautiful-flexible's People

Contributors

grafikart avatar jeremykervran avatar maximeculea avatar nlemoine avatar rahe avatar stephane-gillot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

ajramharakh

bea-beautiful-flexible's Issues

Images not found if Flexible field is in a Repeater field

First of all: Great work!

But the images for the popup are not found if the Flexible field is in a Repeater field.

I found a solution for an existing scenario on my site, but I don't know if this is the correct way for all. I changed the foreach ( $fields as $field ) loop in the retrieve_flexible_keys function to this:

foreach ( $fields as $field ) {
	if ( 'repeater' === $field['type'] ) {
		foreach ($field['sub_fields'] as $repeaterfield) {
			if ( 'flexible_content' === $repeaterfield['type'] ) {
				foreach ( $repeaterfield['layouts'] as $layout_field ) {
					$keys[ $layout_field['key'] ] = $layout_field['name'];
				}							
			}
		}
	} else if ( 'flexible_content' === $field['type'] ) {
		// Flexible is recursive structure with sub_fields into layouts
		foreach ( $field['layouts'] as $layout_field ) {
			if ( $keys [ $layout_field ] ) {
				continue;
			}
			$keys[ $layout_field['key'] ] = $layout_field['name'];
		}
	}
}

Hope, this helps for further development.

Thomas

Same constant BEA_ACF_OPTIONS_MAIN_FILE_DIR as in ACF Options for Polylang

Version information

  • Plugin version : 1.0.5
  • ACF version : 5.8.1
  • PHP : 7.0.10
  • WordPress : 5.2.2

Steps to reproduce

  1. Install and activate ACF Options for Polylang
  2. Install and activate BEA Beautiful Flexible
  3. Consult your debug.log ^^

What was expected

Nothing

What happened instead

( ! ) Notice: Constant BEA_ACF_OPTIONS_MAIN_FILE_DIR already defined in myproject\plugins\bea-beautiful-flexible\bea-beautiful-flexible.php on line 44

Hi there !

You declare the same constant BEA_ACF_OPTIONS_MAIN_FILE_DIR on your 2 projects : ACF Options for Polylang and BEA Beautiful Flexible.

=^.^=

Allow more image formats

It would be great if not only png files would be allowed. Considering the context, it's very likely that jpg is a better candidate to get more compressed files. Gif could also be useful if some field requires a tiny screencast showing something.

Let me know if I can help, I can submit a PR about this.

Custom Path for images on theme

Hello, how are you?

I would like to know if it is possible to put another way for the plugin get the images.

Currently he get the images at:

my-theme \ assets \ bea-beautiful-flexible \

I would like to leave it like this:

my-theme \ assets \ img \ bea-beautiful-flexible \

or a custom name for the folder

my-theme \ assets \ img \ blocks \

Thank you for your attention. 🙂

Change Required Plugin Check

I am developing a theme and including ACF directly in the theme via composer. I added this plugin to the same composer file but cannot activate the plugin because ACF is not being loaded in the list of plugins but rather as part of my theme. Would be nice to be able to filter where ACF is located in my theme, like this:

/**
 * Customize ACF path
 */
add_filter('acf/settings/path', function ( $path ) {
  $path = get_stylesheet_directory() . '/../vendor/advanced-custom-fields/advanced-custom-fields-pro/';
  return $path;
});

/**
* Customize ACF dir
*/
add_filter('acf/settings/dir', function ( $dir ) {
  $dir = get_stylesheet_directory_uri() . '/../vendor/advanced-custom-fields/advanced-custom-fields-pro/';
  return $dir;
});

Simple flexible - Illegal offset type

I get a warning here: https://github.com/BeAPI/bea-beautiful-flexible/blob/master/classes/main.php#L68

$layout_field is an array and can't be used as an array key. I didn't submit a PR because I didn't dig further and don't know what this condition is here to prevent. Did you mean by chance:

if ( $keys [ $layout_field['key'] ] ) {
	continue;
}

?

Let me know if you need more informations.

Version information

  • Plugin version : 1.0.3
  • ACF version : 5.7.4
  • PHP : 7.1
  • WordPress : 4.9.8

Steps to reproduce

  1. Create a flexible
  2. Use this plugin
  3. Visit any page containing the flexible field

What was expected

No notice or warning.

What happened instead

Illegal offset type in /path/to/plugins/bea-beautiful-flexible/classes/main.php on line 69

Images not found if Flexible field is used in a Gutenberg Block

Version information

  • Plugin version : Last
  • ACF version : Last
  • PHP : 7
  • WordPress : Last

Steps to reproduce

  1. Add a flexible content field with a strate
  2. Setup a custom Gutenberg block
  3. assign ACF group to block

What was expected

Images should be visible in the modal

What happened instead

Images are not visible (all other plugins functions seems to work properly)
NB : Tested as well the flexible content outside of Gutenberg, it worked properly.

There is a problem with jQuery noConflict()

There seems to be 3 "$" instead of a "jQuery" in bea-beautiful-flexible-57.min.js

Replacing the $ with jQuery works to fix this.

jQuery(document).ready(function(t){var a=acf.getField("acf-field-flexible-content");a._open=function(n){var e=t(this.$el.children(".tmpl-popup").html());return 1==e.find("a").length?(a.add(e.find("a").attr("data-layout")),!1):a.apply(this,arguments)}}),jQuery("body").on("click",'a[data-name="add-layout"]',function(){setTimeout(function(){$(".acf-fc-popup a").each(function(){var t="<div>"+$(this).text()+"</div>";$(this).html(t)})},0)});

becomes

jQuery(document).ready(function(t){var a=acf.getField("acf-field-flexible-content");a._open=function(n){var e=t(this.$el.children(".tmpl-popup").html());return 1==e.find("a").length?(a.add(e.find("a").attr("data-layout")),!1):a.apply(this,arguments)}}),jQuery("body").on("click",'a[data-name="add-layout"]',function(){setTimeout(function(){jQuery(".acf-fc-popup a").each(function(){var t="<div>"+jQuery(this).text()+"</div>";jQuery(this).html(t)})},0)});

Find a way to i18n

As for now labels are loaded from css before/after there is no possibility to i18n. Maybe do the same with JS which could be i18n.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.