Support » Plugin: WooCommerce PPOM » Override Field Output HTML

  • Resolved brozra

    (@brozra)


    Is there a way to override a textarea’s html output such an action or filter that can be used from a theme’s function.php file? I know I can do this by updating core plug-in files but those changes get overwritten with each update. I’ve also been able to accomplish this with JS but that also is not viable for those who use script blockers.

    Example:

    <div class="my-custom-class">
    <textarea id="textarea_id" name="ppom[fields][textarea_id]" class="form-control" placeholder="" rows="" data-errormsg="Required" maxlength="100"></textarea>
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author N-Media

    (@nmedia)

    Hi @brozra,

    you can see inside this hook, I hope it will help you:
    apply_filters(‘ppom_input_wrapper_class’, $input_wrapper_class, $args);

    I suppose I didn’t explain well enough in my first question. What I meant was something more on the lines like this:

    <div class="my-custom-class">
         <label>Label</label>
         <div class="my-custom-html-container">Custom HTML here</div>
         <textarea></textarea>
    </div>

    Basically I am looking for a hook or action that can override the output of the function Textarea in the NM_Form class. From what I can tell nothing like this exists in the plug-in and I have to manually edit the nmInput.class.php file.

    I would like to ask for a feature to be added to allow for custom HTML before (or) after labels (or) input (input, textarea, select) elements within the meta field editor or even just add some hooks.

    Label example:

    if ($label) {
         $html .= do_action('ppom_custom_html_before_label',$id,$custom_html);
         $html .= '<label class="' . $this->get_default_setting_value('global', 'label_class', $id) . '" for="' . $id . '">';
         $html .= sprintf(__("%s", "ppom"), $label) . '</label>';
         $html .= do_action('ppom_custom_html_after_label',$id,$custom_html);
    }

    Textarea example:

    $html .= do_action('ppom_custom_html_before',$id,$custom_html);
    if ($rich_editor == 'on') {
         ...
    } else {
         ...
    } $html .= do_action('ppom_custom_html_after',$id,$custom_html);

    Of course these examples can be applied to any different field. All that needs to be defined are some new actions.

    Plugin Author N-Media

    (@nmedia)

    Hi,

    I see, yes it needs more filter/actions. So, for now, you can make changes in files as per your need.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.