Customer Portal

Get Involved. Join the Conversation.

Topic

    Clinton Messias
    Widget questions
    Topic posted September 18, 2019 by Clinton MessiasBlue Ribbon: 750+ Points 
    29 Views, 3 Comments
    Title:
    Widget questions
    Content:

    Hello everyone

    I create some contacts custom fields in agent desktop to be displayed in the portal and I need to customize it, each of them needs to be your self customization and in the CP I need to apply CSS in this custom fields, but I don't know how can I call the fields in the PHP code to apply it.

    Somebody can help me?

    Best Regards.

    Comment

     

    • Daniel Rocha

      If I understood correctly, you need to apply unique styles for each custom field you created, right?

      Then you have a couple of ways to achieve that.

       

      Method #1: Wrap the widget with your div, using the classes you want, in the source code.

      <div class="my-custom-input">
          <rn:widget path="input/FormInput" name="incidents.c$my_custom_field" />
      </div>

      Then, in your CSS file, you can override the classes generated by the widget markup.

       

      Method #2: Create a new widget for each of them

      Go to https://<your_interface>.custhelp.com/ci/admin/tools/widgetBuilder and create a new widget. Every widget has its own set of files (with CSS, JS, PHP and HTML), so you can modify them and apply those changes only to that specific widget. With this method you have complete control of what gets rendered in the page, however, if you have a lot of custom fields, this may not be good for maintenance, so consider the next method before doing this.

       

      Method #3: Extend some widget that you can reuse for all, or at least some, of them

      Instead of creating a new widget from the ground up everytime, create one that extends some widget that you can reuse, like the standard/input/FormInput, then apply the changes based on the name of the field. You can get the name with $this->data['attrs']['name'] in the controller.php or this.data.attrs.name in the logic.js.

    • Clinton Messias

      Hi Daniel,

      It's exactly it, thank you very much

      The widget exist any documentation teaching how to create? Because I never create a widget.

      Regards

    • Daniel Rocha

      You can take a look here https://docs.oracle.com/en/cloud/saas/service/19c/famug/customer-portal.html#c_Building_custom_widgets_ae1926726

      It's quite extensive, but explains in detail every step.