Support

Account

Forum Replies Created

  • yazminmedia,
    Fortunately, I got an email before you deleted your comment. The additional plugin use was fairly inconsequential to the question. (Or I assumed so in my answer given)

    In short, you can use a repeater to attach multiple files. If you need additional data on those files you can put those additional fields in the repeater.

    In the example from jaro, they only needed 1 video, but multiple subtitle files which each needed their own additional data (what language they were)

    If you happened to need multiple videos, and each of those needed multiple subtitle files with additional data, you could just nest the repeaters.

  • I am not familiar with webvtt, but would the following work for you?

    "key": "Videos",
    "title": "Videos",
    "fields": [{
    	"key": "video_file",
    	"label": "Video File",
    	"name": "video_file",
    	"type": "file",
    	"required": 1,
    	"return_format": "array",
    	"library": "all",
    },{
    	"key": "subtitles",
    	"label": "Subtitles",
    	"name": "subtitles",
    	"type": "repeater",
    	"required": 0,
    	"min": 0,
    	"max": 0,
    	"sub_fields": [{
    		"key": "language",
    		"label": "Language",
    		"name": "language",
    		"type": "select",
    		"required": 1,
    		"choices": {
    		    "English": "English",
    		    "Dutch": "Dutch"
    		},
    		"return_format": "value",
    	},{
    		"key": "language_file",
    		"label": "File",
    		"name": "file",
    		"type": "file",
    		"required": 1,
    		"return_format": "array",
    		"library": "all",
    	}]
    }]
  • This does not directly answer your question, but WordPress has incredible caching for custom fields. You may see your query count climbing drastically while actual database hits are minimal because of all the cache hits.

    I would test your performance to see if this is an anticipated problem that does not actually need to be solved.

  • Looking into making this an addon, if the developers gave us hooks into field types’
    render_field
    render_field_settings

    it would be doable, but I don’t see how to do it without that.

    Those hooks would not be too difficult to add to acf_field, and then we could have the field types call parent::render_field() and parent::render_field_settings() respectively.

  • I should note, I have also tried running wp_cache_flush() before calling get_field() just in case the field was cached from a previous call.

  • There is a slight tweak one could make to that diff to hide the $no_value_message if relevant. If the dev has any interest in changing their mind, I could make that tweak as well.

  • Since the flexible-content field is only in the pro, I don’t think it’d be a good idea for me to include the full file, but here is a diff:
    https://gist.github.com/trex005/409f1fd873b9487a040ec79b6440a0cf

    If there is any interest I can look into turning it into an addon.

  • I submitted a patch to the author that gave you a layout to automatically add rows up to the minimum row count for that layout.

    It was rejected because they felt that it would complicate the forms too much.

    I believe that many people use flexible content to layout their fields and this could make the fields automatically appear if that is what the field designer wanted.

Viewing 8 posts - 1 through 8 (of 8 total)