Replies: 4 comments
|
@westguard yes, this is a great idea.👍 I actually forgot to port this when I moved over from JS to PHP (html) fields. In the javascript helpers there is still a replace helper. The idea is to use a merge tag like structure. So |
0 replies
|
That sounds perfect! |
0 replies
|
@westguard Because every field has a $link = LinkField::create( 'id', 'Edit Submission' )
->callback( fn( string $field, array $data ) => sprintf( 'https://wp-admin/submissions/view/?id=%d', $data[ $field ] ?? 0 ) )
->with_label( 'Edit Submission #{id}' );Would return <a href="https://wp-admin/submissions/view/?id=123" target="_blank">Edit Submission #123</a>Would that suffice? |
0 replies
|
Yes this is perfect! For WS Form I used: $link = LinkField::create( 'id', __('Edit Submission') )
->callback( fn( string $field, array $data ) => sprintf('/wp-admin/admin.php?page=ws-form-submit&id=123#%d', $data[ $field ] ?? 0) )
->with_label( __('Edit Submission #{id}') );... where |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I wonder if a mask for the href method would be helpful? For example:
LinkField::create( 'submission_id', __('Edit Submission') )->sortable()->always_visible()->href_mask( 'https://mysite.com/wp-admin/submissions/view/?id=#value '),This would output:
https://mysite.com/wp-admin/submissions/view/?id=123#valuecould perhaps be the ID of a column, e.g.#submission_idAll reactions