How To Dynamically Change Form Tab Titles In October CMS

- 1 answer

Is there an efficient method or plugin to dynamically change a Form Tab's title in the October CMS backend?

Similar to how it's done from the Builder plugin, but a bit more user-friendly: enter image description here



You can listen for backend.form.extendFieldsBefore event. You can combine it with DB fetch data from DB and use here (which may be entered by the some user ..)

Write down this in your plugin's boot method.


class Plugin extends PluginBase
    public function boot() {

      \Event::listen('backend.form.extendFieldsBefore', function($widget) {

          if (!$widget->model instanceof \RainLab\User\Models\User) {
              // --------------------------------- ^ Check if its your modal 
              return; // other wise do nothing return

          // rainlab.user::lang.user.account => 
          // translated to Account by Lang Manager

          // need to change  
          // "rainlab.user::lang.user.account" => 'My Account - OK'
          // if you need to change tab's title
          // you need to change it for all fields
          // which uses that same tab title

          foreach ($widget->tabs['fields'] as $key => $val) {
            if($val['tab'] === 'rainlab.user::lang.user.account') {
              $widget->tabs['fields'][$key]['tab'] = 'My Account - OK';



before result

enter image description here

after result

enter image description here if any doubt please comment