=== Massoftind Field Builder ===
Contributors: sandipbiswas123
Donate link: https://masssoftwaresolutions.com/
Tags: custom fields, repeater, field builder, metabox, meta
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.9.36
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Build nested custom fields for WordPress — field builder, repeater fields, metaboxes, location rules, and theme helpers.

== Description ==

Massoftind Field Builder is a custom fields / field builder plugin for WordPress. Create reusable field groups with nested repeaters, galleries, relationships, location rules, and conditional logic — then render values in your theme with safe PHP helpers.

= Try a live demo =

Open WordPress Playground with the plugin preinstalled:

[Try Massoftind Field Builder in WordPress Playground](https://playground.wordpress.net/?plugin=massoftind-field-builder&url=/wp-admin/admin.php%3Fpage%3Dmassoftind-fb-field-groups&php=8.2)

(Or load `blueprint.json` from the plugin zip in the [Playground Builder](https://playground.wordpress.net/builder/builder.html).)

Use the visual builder to add fields, set location rules, and configure presentation. Values are stored as post meta and can be rendered in themes with helpers such as `massoftind_fb_get()` and `massoftind_fb_have_rows()`.

= Video walkthrough =

Watch a short overview of Massoftind Field Builder:

https://www.youtube.com/watch?v=6Z7VDzOmx1M

= What you can build =

* Text, number, email, URL, date, date & time, time, color, and range fields
* Media: image, gallery, file, YouTube video
* Rich content: WYSIWYG, code editor, shortcode, instructional Message
* Choices: select, checkbox, radio, toggle, star rating
* Relations: post object, relationship, taxonomy, user
* Layout: repeater, group, accordion, group tab placement

= Useful features =

* Drag-and-drop field builder with search and duplication
* Location rules (post type, template, taxonomy, and more)
* Conditional logic (show/hide fields)
* Import and export field groups as JSON
* Developer panel with copy-ready template examples
* Optional authenticated REST API for field groups and values
* Built-in documentation in wp-admin
* qTranslate-X / qTranslate-XT: Language Switching Buttons on text fields; front-end helpers return the active language
* WPML + WooCommerce Multilingual (WCML): custom fields registered for translate/copy; product fields sync with WCML
* Integrations: Yoast SEO / Premium, Rank Math / Pro, WooCommerce, WP All Import Pro, WP All Export Pro

= Template helpers =

Use functions such as `massoftind_fb_get()`, `massoftind_fb_update()`, `massoftind_fb_have_rows()`, `massoftind_fb_image()`, and `massoftind_fb_the_gallery()` in theme templates. See the in-plugin documentation for full examples.

= Third-party services =

When a YouTube field is used, the admin and front end may load thumbnails or embeds from YouTube (googlevideo.com / i.ytimg.com). Those requests go to Google/YouTube only when such media is configured. Review [YouTube Terms of Service](https://www.youtube.com/t/terms) if you publish that content.

SVG file uploads are disabled by default. Enable them under Settings → Allow SVG Uploads (administrators only). Developers can also force enable/disable with the `massoftind_fb_allow_svg_uploads` filter.

= Optional integration =

Works alongside **Dynamic Content Builder** for front-end listings driven by custom fields. Compatible with **qTranslate-X** / **qTranslate-XT**, **WPML**, and **WPML Multilingual & Multicurrency for WooCommerce**. No other plugins are required.

== Installation ==

1. Upload the `massoftind-field-builder` folder to `/wp-content/plugins/`, or install the zip via **Plugins → Add New → Upload Plugin**.
2. Activate **Massoftind Field Builder**.
3. Open **Field Builders** in the admin menu.
4. Create a field group, add fields, set location rules, and save.
5. Edit matching content and use template helpers in your theme.

== Frequently Asked Questions ==

= Do I need another custom fields plugin? =

No. Massoftind Field Builder is a standalone field builder with its own metabox UI, repeaters, and template helpers.

= Can I try it before installing? =

Yes. Open the [WordPress Playground live demo](https://playground.wordpress.net/?plugin=massoftind-field-builder&url=/wp-admin/admin.php%3Fpage%3Dmassoftind-fb-field-groups&php=8.2).

= Where are field values stored? =

As prefixed post meta on the content object. Field-group definitions are stored as an internal custom post type.

= Can I move field groups between sites? =

Yes. Use **Tools → Export** and **Import** to transfer JSON field-group definitions.

= Is there a REST API? =

Yes, optional. Enable it under **Field Builders → Settings**. Endpoints require authenticated users with appropriate capabilities.

= Does this phone home? =

No. The plugin does not send your site data to Massoftind.

= Does it work with qTranslate-X? =

Yes. With **qTranslate-X** or **qTranslate-XT** active, text-like fields (text, textarea, WYSIWYG, email, URL, shortcode, code editor, link title) use Language Switching Buttons in the editor. Template helpers such as `massoftind_fb_get()` return the value for the current language on the front end. Values are stored with qTranslate `[:lang]` tags.

= Does it work with Yoast SEO, Rank Math, WP All Import / Export? =

Yes. When those plugins are active, Field Builder registers SEO variables (`%%mfb_field%%` / `mfb_field`), excludes its internal CPT from sitemaps, and exposes fields to WP All Import / Export (complex fields as JSON). WooCommerce products can be targeted with location rules.

= Does it work with WPML / WooCommerce Multilingual? =

Yes. With **WPML** active, Field Builder registers its custom fields for translation or copy/sync, marks Field Builder post types/taxonomies as translatable, and exposes Site Section option values to String Translation. With [WPML Multilingual & Multicurrency for WooCommerce](https://wordpress.org/plugins/woocommerce-multilingual/), translatable fields appear in the WCML product translation UI and values sync when products are duplicated across languages. Override defaults under WPML → Settings → Custom Fields Translation.

== Screenshots ==

1. Simple & Intuitive — create field groups and edit values in a clean admin UI.
2. Made For Developers — template helpers and copy-ready snippets from the developer panel.
3. All About Fields — 30+ field types including media, relations, repeaters, and layout fields.
4. Location Rules — show field groups by post type, template, taxonomy, role, and more.
5. Build. Nest. Publish. — nested builders, conditional logic, and import/export JSON.

== Changelog ==

= 1.9.36 =
* Fix: Native “Custom Fields” Screen Options box stays unchecked/hidden on post edit screens (including CPTs like FAQ), even when Screen Options prefs were already saved.

= 1.9.35 =
* New: Settings → Allow SVG Uploads toggle (off by default). Turns on admin SVG/SVGZ uploads via existing SvgSupport; filter `massoftind_fb_allow_svg_uploads` still overrides.

= 1.9.34 =
* Fix: Field group JSON meta is wp_slash()'d before update_post_meta so instructions/placeholders containing quotes no longer corrupt stored JSON and wipe the field list after save/import.

= 1.9.33 =
* New: Field Type dropdown + Browse Fields in General (change Text to Image without deleting), matching ACF-style editing.
* Fix: Stop rewriting page_template `tamplate-` → `template-` so location rules match real theme filenames.
* Fix: Import empty location defaults to Post Type = Post; duplicate field keys/names in JSON get unique keys on import.

= 1.9.32 =
* Improved: Repeater “Add Row” moved to a modern full-width footer (always visible after scrolling rows); Tools migrate progress/form use max-width 100%.

= 1.9.31 =
* Fix: Content Sync runs in small AJAX batches (progress bar) to avoid Cloudflare/WP Engine 502 Bad Gateway timeouts; WPML meta repair is also chunked.

= 1.9.30 =
* Fix: WPML secondary language empty after ACF→Field Builder migrate — read fallback to original post; migrate all WPML siblings; re-seed translation meta; register bare field names in Custom Fields Translation.

= 1.9.29 =
* Fix: WPML Custom Fields Translation — sync `_massoftind_fb_*` keys to Copy / Copy once in saved WPML settings.

= 1.9.28 =
* Fix: Collapsing a Repeater/Group header now hides all rows and subfields (display:flex was ignoring [hidden]).

= 1.9.27 =
* New: Repeater sections always show a collapse toggle before Add Row (same as Group), with row count badge.

= 1.9.26 =
* Improved: Modern repeater row UI — header bar with chevron, index badge, summary, and compact action toolbar.

= 1.9.25 =
* New: Repeater rows include a collapse/expand toggle (with row summary); Group fields always show a header toggle.

= 1.9.24 =
* Fix: WPML — text fields use copy-once; Field Builder meta is seeded onto translations (English no longer empty); one-time repair for existing translations.

= 1.9.23 =
* Fix: Tab View Left/Top shows each top-level field as a tab (and preserves placement on JSON import).
* New: Optional collapsible accordion headers for Repeater and Group fields (including nested).

= 1.9.22 =
* New: Edit Fields link on field-group metaboxes (post edit) opens the Field Group builder for admins.

= 1.9.21 =
* New: Integrations for Yoast SEO / Premium, Rank Math / Pro, WooCommerce, WP All Import Pro, and WP All Export Pro (auto-detected).

= 1.9.20 =
* Fix: Template compatibility loads even if only some helpers exist; have_rows() aborts instead of hanging when the_row() is omitted.
* Fix: Single FAQ theme pattern (if/while have_rows + the_row) stays safe under template compatibility.

= 1.9.19 =
* Improved: Removed third-party product branding from public docs/changelogs and renamed internal import helpers to portable/legacy wording (import + meta compatibility unchanged).

= 1.9.17 =
* New: Content Order — drag-reorder posts/CPTs and taxonomy terms from Field Builders → Content Order (menu_order / term meta; no separate ordering plugin).

= 1.9.16 =
* New: Settings → General → Classic Editor toggle — use TinyMCE instead of the block editor without a separate Classic Editor plugin.

= 1.9.15 =
* Fix: List View column drag-and-drop (Title / Author / Date / Featured Image reorder) — handle was a button blocked by jQuery UI Sortable.
* Fix: Status filter on non-order post types (e.g. Home Banner) no longer lists WooCommerce / unrelated plugin statuses.

= 1.9.14 =
* Fix: Force Featured Image metabox for Field Builder CPTs (Home Banner) when theme/plugins prevent core from adding it — appears in Screen Options again.

= 1.9.13 =
* Fix: Featured Image metabox for imported CPTs (e.g. Home Banner) when the theme limits `post-thumbnails`.
* Fix: WPML empty CPT lists (e.g. FAQ “No faq found” while All count is > 0) by syncing CPT translation settings and assigning default language to orphan posts.
* Fix: Native “Custom Fields” metabox is hidden by default in Screen Options.
* Improved: WooCommerce core post types are reserved; WPML + WooCommerce Multilingual field sync kept.

= 1.9.12 =
* Fix: WYSIWYG Content fields now run shortcodes (e.g. `[product_categories …]`) like WordPress post content.

= 1.9.11 =
* Fix: Nested repeater / group `have_rows()` now works with nested `if ( have_rows() ) { while ( have_rows() ) }` loops under a repeater.
* Fix: Taxonomy fields with portable `field_type=multi_select` return term ID arrays correctly when `multiple` is 0.
* Fix: `get_field( '…', 'product_cat_123' )` / term selectors read term meta (legacy + Massoftind keys).
* Fix: Relationship `return_format` (object vs id) honored for template compatibility.

= 1.9.10 =
* Fix: Saving Post Types / Taxonomies / List Views / Site Sections no longer triggers “headers already sent”.
* Fix: Empty portable `menu_position` imports as default 25 (exports often use `""` when unset).

= 1.9.9 =
* Fix: Portable JSON import now creates Post Types, Taxonomies, and Site Sections (options pages) from mixed exports — not only field groups.

= 1.9.8 =
* Improved: Field Groups bulk actions dropdown, Apply button, and row checkboxes match the dashboard UI.

= 1.9.7 =
* Fix: Layout Blocks “Add Section” button was clipped by icon-button width (34px); labeled button now uses auto width.

= 1.9.6 =
* Fix: Layout Blocks “Add Section” no longer shows a duplicate dark tooltip over the blue button.

= 1.9.5 =
* Compatibility: Gallery return format defaults to Image Array (`ID`, `url`, …) for existing theme loops.
* Fix: Align readme Stable tag with plugin header version.
* Docs: Add video walkthrough link.

= 1.9.4 =
* Fix: Content Sync overwrites outdated/dead gallery IDs and other stale Massoftind meta.
* Improved: Tools page simplified — one-click “Sync everything now” plus advanced options.

= 1.9.3 =
* Fix: Layout Blocks rebuild from portable flexible meta that stores an ordered list of layout slugs.
* Fix: Gallery falls through to unprefixed meta when stored attachment IDs are missing.

= 1.9.2 =
* Fix: Gallery and Layout Blocks fall through to legacy/unprefixed meta when Massoftind storage holds a non-usable value (e.g. flexible row count instead of rows).
* Fix: Legacy row rebuild keeps leaf meta keys with underscores (section_heading, layout row keys).
* New: Field Groups list — select all / bulk delete.

= 1.9.1 =
* Fix: Remap imported conditional logic from field keys to field names so dependent fields show correctly.
* Fix: After-title field groups (Banner Video / Banner Text) render on the edit screen.
* Fix: Stop empty one-tab-per-field UI when tab markers were skipped on import; Gallery and Layout Blocks show again.
* Fix: Gallery attachment ID parsing for portable array-shaped values.

= 1.9.0 =
* New: Message field (instructional text in the editor; no stored value).
* New: Date & Time field (`datetime`) with import mapping from portable JSON.
* New: Programmatic write helpers — `massoftind_fb_update()`, `massoftind_fb_add_row()`, `massoftind_fb_delete_row()` (optional template-compat aliases when enabled).
* Improved: Location rules — post status, post format, post taxonomy, attachment, user form, comment.
* Improved: JSON import fidelity for clone, password, message, and date-time types; editor-only tab markers are skipped (group tab placement still detected).
* Compatibility: WPML translate list includes message fields; branding/docs avoid third-party trademarks.

= 1.8.1 =
* New: WPML compatibility — register Field Builder meta for translate/copy, CPT/taxonomy translate flags, Site Section admin texts.
* New: WooCommerce Multilingual (WCML) support — product translation fields + meta sync on duplicate.
* New: List Views (admin list-table columns) and related admin polish.

= 1.6.0 =
* New: Layout Blocks field — add ordered content sections, each using a named layout with its own sub-fields.
* Import: portable flexible_content JSON → Layout Blocks (layouts preserved).
* Theme helpers: massoftind_fb_get_layout() and get_row_layout() (when template compatibility is enabled).
* Legacy meta: read flexible-style layout row keys into Layout Blocks values.

= 1.5.0 =
* Migration helpers: Settings toggles for template compatibility and legacy meta read fallback.
* Legacy meta: read unprefixed field names and repeater row keys when Massoftind meta is empty; Tools page can copy values into Massoftind storage.
* Site Sections: read/migrate `options_*` (and custom roots); helpers with 'option' supported.
* Import: location rule normalization (template path typos, options_page), more type mappings, relationship post_types.

= 1.4.0 =
* Optional theme helper aliases when not already defined (get_field, have_rows, get_sub_field, the_row, …).
* Nested repeater loops (have_rows inside have_rows) for common theme templates.
* Image return format "array" returns keys (ID, url, alt) with back-compat numeric indexes.

= 1.3.61 =
* Fix: Text / Textarea always keep safe HTML tags (span, strong, em, i, b, u, br, a) on Update — no toggle required.

= 1.3.60 =
* Text / Textarea: Allow basic HTML setting + massoftind_fb_kses_basic_html() helper.

= 1.3.59 =
* Promo: WordPress Playground blueprint for one-click live demo.
* Admin: dashboard onboarding checklist (first field group in minutes).
* Admin: optional dismissible review nudge after a field group exists.

= 1.3.58 =
* Fix: qTranslate-X compatibility — read raw Field Builder meta then translate strings so repeater have_rows()/sub_field() work on the front end.

= 1.3.57 =
* Fix: lock main page ID before get_header so repeater helpers read the correct post meta.
* Fix: empty key-based meta arrays no longer block fallback to name-based stored values.

= 1.3.56 =
* Fix: template helpers prefer the queried page ID on singular views so values still load after get_header() / secondary loops.

= 1.3.55 =
* Fix: have_rows() on Group fields no longer drops text sub-fields (badge/heading empty while loop still ran).

= 1.3.54 =
* Fix: nested Sub Fields drag-and-drop blocked by sortable cancel matching parent inline config panels.

= 1.3.53 =
* UI: remove help “i” icons next to Label / Name and other setting labels.

= 1.3.52 =
* Fix: builder tooltips clipped by overflow — Delete/Drag tips now show.
* Fix: drag-reorder for deeply nested Sub Fields (Repeater → Group → Repeater → fields).

= 1.3.51 =
* Fix: text domain aligned to plugin slug massoftind-field-builder.
* Security: sanitize posted field trees and AJAX JSON payloads before use.
* Fix: remove standalone wp_enqueue_script(wplink); load via script dependencies (core handle).

= 1.3.50 =
* Fix: SVG image/gallery admin preview blank after save (inlined SVG was stripped by wp_kses_post; use img preview instead).

= 1.3.49 =
* Fix: harden sanitize for checkbox, image, file, gallery, relationship, range, video, and YouTube against array POST / "Array" corruption.
* Fix: re-sync qTranslate hooks after AJAX-added repeater, accordion, and tabs rows.

= 1.3.48 =
* Fix: repeater delete + qTranslate — rebind hidden language field names after reindex so removed rows stay removed.
* Fix: scalar fields no longer save PHP "(string) array" as the literal text "Array".
* Fix: drop empty/corrupt repeater rows (junk nested rows created by stale multilingual POST data).

= 1.3.47 =
* Plugin Check: echo SVG/video HTML via wp_kses() directly (custom kses wrappers are not recognized by PHPCS).

= 1.3.46 =
* Security: tighten REST permission callbacks (manage_options for field groups; edit_post for per-post field values).
* I18n: text domain aligned to WordPress.org slug `massoftind-field-builder`.
* Security: late-escape admin/field output (attributes, SVG, shortcodes, media previews) via esc_attr / wp_kses / wp_kses_post.
* Prefixing: remove generic DFB_* global constants; keep massoftind_fb / MASSOFTIND_FB prefixes.

= 1.3.45 =
* Fix: when two field groups use the same field name, helpers pick the field that has stored values (not the empty duplicate).

= 1.3.44 =
* Native qTranslate-X / qTranslate-XT support: admin Language Switching Buttons and front-end language decode for template helpers.

= 1.3.43 =
* Rebranded to Massoftind Field Builder (slug, text domain, namespace, prefixes).
* Removed non-GPL Fancybox; gallery lightbox is plugin GPL JS. Masonry uses WordPress core only.
* Assets load via wp_enqueue_* / wp_add_inline_*; no inline style/script tags in templates.
* WordPress.org submission polish: remove trademark tag; defer plugin details to the official directory API.

= 1.3.42 =
* Plugin Check: replace var_export in developer code generator; document intentional meta_key ordering query.

= 1.3.41 =
* Plugin Check fixes: translators comments, local asset loading (no CDN), wp_enqueue_style for details modal.

= 1.3.40 =
* WordPress.org packaging: readme.txt, license.txt, Plugin Check cleanup, author/branding alignment.

= 1.3.39 =
* Developer Panel: Full Template Example for Repeaters/Groups includes Conditional Logic as PHP `if` checks.

= 1.3.38 =
* Fixed Conditional Logic dropdown changes triggering a full panel rebuild on autosave.

= 1.3.37 =
* Date field: Display Format and Return Format settings; `massoftind_fb_date()` / `massoftind_fb_the_date()` helpers.

== Upgrade Notice ==

= 1.9.5 =
Stable tag aligned with plugin version; gallery Image Array return format; video walkthrough link.

= 1.6.0 =
Adds Layout Blocks for composable page sections, portable flexible-layout JSON import, and get_row_layout() compatibility.

= 1.5.0 =
Adds migration helpers: legacy meta read fallback, Tools migration, and Settings toggles for template compatibility.

= 1.3.44 =
Adds native qTranslate-X / qTranslate-XT support for multilingual field values.

= 1.3.43 =
WordPress.org-first packaging: safer readme tags and official plugin information flow.

= 1.3.42 =
Plugin Check warning fixes for developer code generation and field group ordering.

= 1.3.41 =
Plugin Check error fixes; gallery libraries bundled locally.

= 1.3.40 =
WordPress.org submission package; requires WordPress 6.2+.

= 1.3.39 =
Developer Panel conditional-logic template examples for nested fields.
