feat(elementskit): add ElementsKit integration - #213
Open
RishadAlam wants to merge 7 commits into
Open
RishadAlam wants to merge 7 commits into
RishadAlam wants to merge 7 commits into
Conversation
Free side of the ElementsKit action integration. It performs no writes of its
own — each action fires bit_integrations_elements_kit_* and lets the Pro
handler do the work, then logs whatever comes back.
RecordApiHelper switches over the eleven write actions with a literal hook
string per case, and passes only the arguments each Pro handler reads: the
field map alone for update_setting, plus utilities and/or the integration
config for the rest.
Also adds the refresh_elements_kit_contents route, which lists dynamic content
items for the optional parent dropdown. That is a read, so it stays in Free.
ElementsKit Lite defines no plugin constant, so class_exists('ElementsKit_Lite')
is the activation check throughout.
Three-step wizard plus the edit screen, cloned from the FluentCart layout, and registered in NewInteg, EditInteg, IntegInfo and SelectAction. Authorization goes through the shared WP_PLUGIN_CHECK step. ElementsKit Lite ships no plugin constant, so the check asserts on its main class instead, which PluginCheck already supports as a `class` type. Inputs are split the way the field-map rule asks for. The id of the record an action targets — template, widget, content, setting key — stays in the field map so it can be mapped from trigger data. Fixed option sets are selects: template type and activation render in the layout where the action requires them, and status, type, display conditions and delete mode sit behind Utilities. The optional parent item is the one fetched dropdown. The FieldMap component drops an inherited bug while cloning: the required-field branch compared an index against the array rather than its length, and then read .label where the option value belongs, so the second select never pre-filled. It now compares against .length and uses .key.
Four problems in the ElementsKit action screen. A ticked Utility could never be unticked. The checkbox always reopened the picker, so once a Status or Delete Mode override was set there was no way to remove it and the action carried that value on every run. Ticking now opens the picker and unticking clears the value. The Parent Item dropdown passed a boolean rather than an array while the fetch was still in flight, because the guard chain collapsed to false instead of an empty list. There was also no way to detach a parent once one had been chosen, only to swap it for another. A No Parent option covers that; the Pro handler tells an explicit choice apart from an untouched dropdown. Each Utility modal printed its title twice, since ConfirmModal already renders the title as its header and the body repeated the same string. The header now carries the short name and the body explains what the option does.
Removes the action from the module list, the field-map definition it used and the hook case that fired it. Ten actions remain, covering templates, widgets and dynamic content.
… blob Icon, Categories, Markup, CSS and JavaScript become field-map rows on Create Widget and Update Widget, so their values can come from the form submission rather than being embedded in a hand-written JSON string. Categories accepts a comma separated list. Widget Controls keeps taking JSON, because the Elementor controls nest sections inside tabs and controls inside sections and cannot be flattened into a field map. The Pro handler treats it as the base layer and lays the mapped fields over it.
Removes the two file header blocks that only repeated the namespace and a block label above the option-set constants. The translators note above the wp_sprintf call stays, since phpcs requires it, along with the comments explaining why the plugin class stands in for a missing constant, why the parent list refetches on edit, and why unticking a utility clears it.
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Removes both actions from the module list, the field-map definitions they used, their entries in the status-utility and utilities lists, the switch cases in the integration layout, the Widget Controls JSON note, and the two Hooks::apply dispatch cases in RecordApiHelper. Get Widget, Delete Widget and the widget triggers are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Adds the free side of the ElementsKit integration: the action backend that fires the
bit_integrations_elements_kit_*hooks and logs the result, and the three-step integration UI. Ten write actions covering ElementsKit templates, Widget Builder widgets and dynamic content.Pairs with the matching PR on
bit-integrations-pro, which carries the handlers those hooks call.Motivation & Context
ElementsKit is one of the most widely used Elementor addons, but the headers, footers and custom widgets it manages could not be created or updated from a flow. This adds it as an action app, so a form submission or any other trigger can build and maintain those pieces without anyone opening the builder.
Per the split, Free performs no writes of its own — it fires the hook and records the response in the Task Log.
Related Links: (if applicable)
Type of Change
Key Changes
Backend
ElementsKitControllerwith the activation check, the dynamic content list used by the parent dropdown, andexecute()RecordApiHelperswitching over the ten write actions, with a literal hook string per case andLogHandler::saveon every pathRoutes.phpexposingrefresh_elements_kit_contentsElementsKitentry toAllTriggersNameclass_exists('ElementsKit_Lite')as the activation marker, since ElementsKit Lite defines no plugin constantFrontend
NewInteg,EditInteg,IntegInfoandSelectActionWP_PLUGIN_CHECKstep, asserting on the plugin class rather than a constantChecklist
Changelog