Skip to content

Magic Links V2 #2798

@corsacca

Description

@corsacca

Current
/root/type/key
Magic links are a url that opens up a small portal or app. The key is is unique to each record/user and determines access to data and what is shown.

V2

All magic links start with /apps.

Currently every url is check to see if it matches an existing magic link. This is inefficient and tends to lead to unneeded database calls.

Streamline App registration in code

Make registration simpler. We currently have a bunch of class variables, hooks, magic functions. Here as some examples:

public $post_type = '';
    public $type = '';
    public $type_name = '';
    private $meta_key;
    public $page_title = '';
    public $page_description = '';
    public $type_actions = [
        '' => 'Manage',
    ];
    public $show_bulk_send = false; // enables bulk send of magic links from list page
    public $show_app_tile = false; // enables addition to "app" tile sharing features

    public $module = ''; // Lets a magic url be a module as well
    public $instance_id = ''; // Allows having multiple versions of the same magic link for a user. Creating different meta_keys.
    public $meta = []; 


public function __construct( $template = null ) {
        $this->meta = [
            'app_type'   => 'magic_link',
            'class_type' => 'template',
            'show_in_home_apps' => $show_in_apps,
            'icon' => 'mdi mdi-account-network',
        ];
}



    public function dt_settings_apps_list( $apps_list ) {
        $apps_list[ $this->meta_key ] = [
            'key'              => $this->meta_key,
            'url_base'         => $this->root . '/' . $this->type,
            'label'            => $this->page_title,
            'description'      => $this->page_description,
            'settings_display' => true
        ];

        return $apps_list;
    }

Separate the registration and the running of the magic links

Registration lets magic links show in the home screen, user and contact tiles, user settings, etc

Loading the magic link page and running the api calls should only happen when the specific magic link is being loaded or user.

All form magic links use same code to display fields and handle field updates.

Currently we have multiple implementations of field rendering and magic link submits

Pull magic link template creating into core

  • this will be 🔥

Rename magic links to Apps

Remove theme js and css for loading on magic links unless explicitly requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions