Skip to content

Plugin features: Description callback - Set parameter inside render_features_settings_page#20

Open
nicolas-jaussaud wants to merge 1 commit intomainfrom
feature/plugin/features-description-callback
Open

Plugin features: Description callback - Set parameter inside render_features_settings_page#20
nicolas-jaussaud wants to merge 1 commit intomainfrom
feature/plugin/features-description-callback

Conversation

@nicolas-jaussaud
Copy link
Contributor

Hi @eliot-akira!

Currently, we can pass a description callback as a parameter when rendering a checkbox/switch, with the render_setting_field_checkbox function:

use tangible\framework as framework; 

framework\render_setting_field_checkbox([
   // ...
  'description' => function() {
    echo 'Description';
  };
]);

However, the function will attempt to pass parameters to the description callback related to the plugin features functionality:

if (is_callable($description)) {
  $description(
    tangible\framework\get_plugin_feature_settings($plugin, $feature),
    tangible\framework\get_plugin_feature_settings_key($plugin, $feature),
    $is_enabled
  );
} else {

This pull request move the plugin features related parameters outside of the function, and define them inside the render_features_settings_page instead

…eatures_settings_page instead of inside render_setting_field_checkbox
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.

1 participant

Comments