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 |
Beta Was this translation helpful? Give feedback.
-
That sounds perfect! |
Beta Was this translation helpful? Give feedback.
-
@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? |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
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
#value
could perhaps be the ID of a column, e.g.#submission_id
Beta Was this translation helpful? Give feedback.
All reactions