Open ghost opened 1 year ago
Did you try using Element Studio?
https://breakdance.com/documentation/developers/element-studio/
Edit: Looks like you did. I am wondering about your thoughts about current developer experience.
In terms of elements JS framework we do have some improvements already planned for Element Studio. Very similar to factory solution you proposed. I passed this internally for the reference.
Yes, but a API for Power Developer should be also great. Element Studio is really cool, but I think many Developer missing some features like transpiing, autocompletion, Copilot, SCSS (or other) npm and other stuff.
This can be only managed by an IDE and therefore a simple Framework has none of the other Page Builders (the only one is WPBackery).
Am 22.03.2023 um 11:22 schrieb Andrzej Dubiel @.***>:
Did you try using Element Studio?
https://breakdance.com/documentation/developers/element-studio/ https://breakdance.com/documentation/developers/element-studio/ — Reply to this email directly, view it on GitHub https://github.com/soflyy/breakdance-bugs/issues/730#issuecomment-1479287369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZY3PBU2DNQ2JUZ26PBKWDW5LHGRANCNFSM6AAAAAAWCZDZWE. You are receiving this because you authored the thread.
As I said. Element Studio is really great. But I am missing scss, webpack and so on - but these can also be my personal impressions. I can live with Element Studio ;-) . Factory classes sounds great. It would be also great, if it were possible to transfer the elements not just to a separate plugin. I mostly use my own themes. I just like having everything in one place. That's why it would be great if Element Studio also offered the option of transferring the created elements to your own theme and still having the option of expanding them in Element Studio.
I'm trying to write my own little framework. For example, to quickly create own dynamic fields. I will try to implement this with dynamic classes... let's see if this works ;-).
At the moment I could only set some simple Options like:
WPB_Breakdance::disable_google_fonts();
WPB_Breakdance::enable_core_features();
WPB_Breakdance::register_category( 'WPB', 'wpb' );
core_features are like:
if ( function_exists( 'pll_the_languages' ) ) {
add_action("breakdance_register_template_types_and_conditions", function () {
if (function_exists("pll_languages_list")) {
$lang_list = \pll_languages_list();
\Breakdance\ConditionsAPI\register([
"supports" => ["element_display", "templating"],
"slug" => "wpb-breakdance-polylang-condition",
"label" => "Language",
"category" => "Polylang",
"allowMultiselect" => false,
"operands" => ["equals", "not equals"],
"values" => function () use ($lang_list) {
return [
[
"label" => "Language",
"items" => array_map(function ($lang_list) {
return [
"text" => $lang_list,
"value" => $lang_list,
];
}, $lang_list),
],
];
},
"callback" => function (string $operand, $value) {
$myVal = \pll_current_language();
if ($operand === "equals") {
return $val === $value;
}
if ($operand === "not equals") {
return $val !== $value;
}
return false;
},
]);
}
});
}
Is it possible to unregister Icons (FontAwesome and so on) and unregister Elements to hide some for Customers?
Yes it works with anonymous functions ^^:
That's the only, I need to write to add a dynamic field. So that's really cool to fast implement custom dynamic Fields. Parameters: Slug, Label, Category There is one last Parameter optional to specify if it is a StringField (string).
You see, less code to write.
WPB_Breakdance::register_dynamic_field( 'test', 'Test', 'Test' )
->set_return_types( [ 'string' ] )
->set_handler(
function( $attributes ) {
return 'test';
}
);
It would be nice to have a simple Developer API Framework like Typerocket to create Custom Elements and Custom Fieldtypes. Also a Utility Class could help to validate and specify $propertiesData in %%SSR%% and build Custom Elements quickly.
So instead of use: $id = $propertiesData['content']['section']['field'];
The Utility Class could be look like:
$id = $this->getAsInt( 'content/section', 'id', 0 ); The last parameter is a default Value;
Or:
$text = $this->getAsString( 'content/section', 'text', 'Hello World', $PREPEND_IF_HAS_VALUE, $APPEND_IF_HAS_VALUE );
Or:
$isVisible = $this->getAsBool( 'design/section', 'isVisible', true );
The API could look like (for example a simple Video Element):
Also a JS Framework would be cool, like a Factory Class, so Loops to match these elements don't need to be self coded. For example what if I have a Custom Element and this element needs some JS (not inline). When i add these elements for example 3 times, I need to loop and self identify these elements and match them.
A custom Factory Class could be like:
And for a Element like Video...
So the developer only needs only register the Element by Selector and Class.
window.BD_FACTORY_ELEMENT_CLASS.add( Video, 'video' );