Skip to content

feat: #4388 Responsive options docs - #79

Open
orkunaybek wants to merge 4 commits into
mainfrom
feature/issue-4388/responsive-options-docs
Open

orkunaybek wants to merge 4 commits into
mainfrom
feature/issue-4388/responsive-options-docs

Conversation

@orkunaybek

Copy link
Copy Markdown
Contributor

No description provided.

@cagdasdag

Copy link
Copy Markdown
Collaborator

Just one thing, we have added

the "Hide element" toggle can be turned off per element with 'settings' => [ 'hide_toggle' => false ] on the css_editor param (it defaults to true).

I feel like we can also mention that https://github.com/wpbakery/js_composer/pull/4334#discussion_r4207619300 it is added recently after Oleg's comment


Important part in this snippet is `vc_shortcode_custom_css_class()` function call, it is parsing `css` attribute and outputs its name in the element's html markup.

Since version 9.1 every element with a `css_editor` param also gets the "Hide element" toggle at the top of the Design Options tab. Its value is stored in the `hide_element` attribute, with per device values in `hide_element_wpb_{device}`, and the hide classes are added through the `VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG` filter, so the template above needs no changes. To leave the toggle out, set `'settings' => [ 'hide_toggle' => false ]` on the param. The Design Options values themselves are set per device only when the param carries `'responsive' => true`: add it to the param above, or map the tab with `vc_config()->get_design_options_tab()`, which already carries it. Read more in [Make a param responsive](/devs/developer-tutorials/make-a-param-responsive).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Its value is stored in the hide_element attribute, with per device values in hide_element_wpb_{device}, and the hide classes are added through the VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG filter, so the template above needs no changes. "
Looks like redundant and complicated data for users here; even I find it hard to understand looks better without it.

@@ -0,0 +1,63 @@
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to add this page to a page list here devs/developer-tutorials/overview/ cos right now it only in left menu


Device left empty uses the value of the main param, and a device value equal to it is not stored. Pages saved before 9.1 simply have no such attributes.

## HTML output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a working code example here you can combine it together with you current mapping snippet
add_action( 'vc_before_init', 'your_name_integrateWithVC' );
function your_name_integrateWithVC() {

 vc_map( [
  'name' => __( 'Bar tag test', 'my-text-domain' ),
  'base' => 'bartag',
  'params' => [
   [
    'type' => 'textfield',
    'heading' => __( 'Height', 'my-text-domain' ),
    'param_name' => 'height',
    'value' => '300',
    'responsive' => true,
   ],
  ],
 ] );
}
class WPBakeryShortCode_Bartag extends WPBakeryShortCode {
}

so youser can with one click copy/paste it to his functions.php

add_action( 'vc_after_init_responsive', 'wpb_after_responsive_init' );

function wpb_after_responsive_init() {
// Run custom logic once the responsive services (breakpoints, devices, params, hide) are ready

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always better to have here something more visual code exmple then just a comment

add_action( 'vc_before_init_responsive', 'wpb_before_responsive_init' );

function wpb_before_responsive_init() {
// Run custom logic before the responsive services (breakpoints, devices, params, hide) are created

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always better to have here something more visual code exmple then just a comment

- Tablet horizontal breakpoint (1024px by default);
- Tablet vertical breakpoint (768px by default);
- Mobile horizontal breakpoint (640px by default).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also todo with screenshot demanding how to see it in seetings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants