Inpsyde\MultilingualPress\Common\Admin\SettingsPage::url PHP Method

url() public method

Returns the full URL.
Since: 3.0.0
public url ( ) : string
return string URL.
    public function url()
    {
        if (!isset($this->url)) {
            $url = add_query_arg('page', $this->slug, $this->parent ?: 'admin.php');
            switch ($this->admin) {
                case self::ADMIN_NETWORK:
                    $this->url = network_admin_url($url);
                    break;
                case self::ADMIN_SITE:
                    $this->url = admin_url($url);
                    break;
                case self::ADMIN_USER:
                    $this->url = user_admin_url($url);
                    break;
            }
        }
        return $this->url;
    }

Usage Example

 /**
  * Updates the plugin settings according to the data in the request.
  *
  * @since 3.0.0
  *
  * @return void
  */
 public function update_settings()
 {
     \Inpsyde\MultilingualPress\check_admin_referer($this->nonce);
     array_walk(array_keys($this->module_manager->get_modules()), [$this, 'update_module']);
     $this->module_manager->save_modules();
     /**
      * Runs before the redirect.
      *
      * Process your fields in the $_POST superglobal here and then call update_site_option().
      *
      * @param array $_POST
      */
     do_action('mlp_modules_save_fields', $_POST);
     wp_safe_redirect(add_query_arg('message', 'updated', $this->settings_page->url()));
     \Inpsyde\MultilingualPress\call_exit();
 }