Change `$this` reference with `this` in dialog opening code