GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
Handle the [gv_entry_link] shortcode. More...
Public Member Functions | |
__construct () | |
delete_shortcode ( $atts=array(), $content=null, $context='gv_delete_entry_link') | |
Backward compatibility for existing gv_delete_entry_link shortcodes Forces $atts['action'] to "delete". More... | |
edit_shortcode ( $atts=array(), $content=null, $context='gv_edit_entry_link') | |
Backward compatibility for existing gv_edit_entry_link shortcode Forces $atts['action'] to "edit". More... | |
read_shortcode ( $atts, $content=null, $context='gv_entry_link') | |
Generate a link to an entry. More... | |
Private Member Functions | |
add_hooks () | |
Add shortcodes. More... | |
get_anchor_text ( $content=null) | |
Get the anchor text for the link. More... | |
get_entry ( $entry_id=0) | |
Get entry array from entry_id parameter. More... | |
get_link_atts () | |
Parse shortcode atts to fetch link_atts , which will be added to the output of the HTML anchor tag generated by shortcode Only used when return value of shortcode is not "url". More... | |
get_url () | |
Get the URL for the entry. More... | |
has_cap () | |
Check whether the user has the capability to see the shortcode output, depending on the action ('read', 'edit', 'delete') More... | |
maybe_add_field_values_query_args ( $url) | |
Allow passing URL params to dynamically populate the Edit Entry form If field_values key is set, run it through parse_str() and add the values to $url. More... | |
shortcode ( $atts, $content=null, $context='gv_entry_link') | |
Generate a link to an entry. More... | |
Private Attributes | |
$entry = array() | |
array Entry fetched using the $atts['entry_id'] shortcode setting. More... | |
$settings = array() | |
array The final settings for the shortcode, after merging passed $atts with self::$defaults More... | |
$view_id = 0 | |
int If set, generate a link to the entry for this View ID. More... | |
Static Private Attributes | |
static | $defaults |
array The accepted shortcode attribute pairs, with defaults set More... | |
Handle the [gv_entry_link] shortcode.
Replaces [gv_edit_entry_link] and [gv_delete_entry_link] shortcodes
Definition at line 10 of file class-gravityview-entry-link-shortcode.php.
__construct | ( | ) |
Definition at line 44 of file class-gravityview-entry-link-shortcode.php.
References add_hooks().
|
private |
Add shortcodes.
Definition at line 53 of file class-gravityview-entry-link-shortcode.php.
Referenced by __construct().
delete_shortcode | ( | $atts = array() , |
|
$content = null , |
|||
$context = 'gv_delete_entry_link' |
|||
) |
Backward compatibility for existing gv_delete_entry_link
shortcodes Forces $atts['action'] to "delete".
array | $atts | { string $action What type of link to generate. Options: read , edit , and delete . Default: read string $view_id Define the ID for the View. If not set, use current View ID, if exists. string $entry_id ID of the entry to edit. If undefined, uses the current entry ID, if exists. string $post_id ID of the base post or page to use for an embedded View string $link_atts Pass anchor tag attributes (target=_blank to open Edit Entry link in a new window, for example) string $return What should the shortcode return: link HTML (html ) or the URL (url ). Default: html string $field_values Only used for action="edit" . Parameters to pass in to the prefill data in Edit Entry form. Uses the same format as Gravity Forms "Allow field to be populated dynamically" { |
string | null | $content | Used as link anchor text, if specified. |
string | $context | Current shortcode being called. Not used. |
<a>
HTML tag. Definition at line 90 of file class-gravityview-entry-link-shortcode.php.
References $content, and shortcode().
edit_shortcode | ( | $atts = array() , |
|
$content = null , |
|||
$context = 'gv_edit_entry_link' |
|||
) |
Backward compatibility for existing gv_edit_entry_link
shortcode Forces $atts['action'] to "edit".
array | $atts | { string $action What type of link to generate. Options: read , edit , and delete . Default: read string $view_id Define the ID for the View. If not set, use current View ID, if exists. string $entry_id ID of the entry to edit. If undefined, uses the current entry ID, if exists. string $post_id ID of the base post or page to use for an embedded View string $link_atts Pass anchor tag attributes (target=_blank to open Edit Entry link in a new window, for example) string $return What should the shortcode return: link HTML (html ) or the URL (url ). Default: html string $field_values Only used for action="edit" . Parameters to pass in to the prefill data in Edit Entry form. Uses the same format as Gravity Forms "Allow field to be populated dynamically" { |
string | null | $content | Used as link anchor text, if specified. |
string | $context | Current shortcode being called. Not used. |
<a>
HTML tag. Definition at line 74 of file class-gravityview-entry-link-shortcode.php.
References $content, and shortcode().
|
private |
Get the anchor text for the link.
If content inside shortcode is defined, use that as the text. Otherwise, use default values.
Only used when return
value of shortcode is not "url"
string | null | $content | Content inside shortcode, if defined |
Definition at line 225 of file class-gravityview-entry-link-shortcode.php.
References $content.
Referenced by shortcode().
|
private |
Get entry array from entry_id
parameter.
If no $entry_id
int | string | $entry_id | Gravity Forms Entry ID. If not passed, current View's current entry ID will be used, if found. |
Definition at line 312 of file class-gravityview-entry-link-shortcode.php.
References $entries, $entry, View\by_id(), GVCommon\get_entry(), GravityView_frontend\getInstance(), GravityView_View\getInstance(), and gravityview().
Referenced by shortcode().
|
private |
Parse shortcode atts to fetch link_atts
, which will be added to the output of the HTML anchor tag generated by shortcode Only used when return
value of shortcode is not "url".
Definition at line 203 of file class-gravityview-entry-link-shortcode.php.
References $link_atts, and GravityView_Delete_Entry\get_confirm_dialog().
Referenced by shortcode().
|
private |
Get the URL for the entry.
Uses the post_id
, view_id
params as defined in the shortcode attributes.
string | null | $content | Content inside shortcode, if defined |
Definition at line 256 of file class-gravityview-entry-link-shortcode.php.
References $url, GravityView_API\entry_link(), GravityView_Delete_Entry\get_delete_link(), GravityView_Edit_Entry\get_edit_link(), and maybe_add_field_values_query_args().
Referenced by shortcode().
|
private |
Check whether the user has the capability to see the shortcode output, depending on the action ('read', 'edit', 'delete')
Definition at line 284 of file class-gravityview-entry-link-shortcode.php.
References GravityView_Delete_Entry\check_user_cap_delete_entry(), and GravityView_Edit_Entry\check_user_cap_edit_entry().
Referenced by shortcode().
|
private |
Allow passing URL params to dynamically populate the Edit Entry form If field_values
key is set, run it through parse_str()
and add the values to $url.
string | $href | URL |
Definition at line 365 of file class-gravityview-entry-link-shortcode.php.
References $url.
Referenced by get_url().
read_shortcode | ( | $atts, | |
$content = null , |
|||
$context = 'gv_entry_link' |
|||
) |
Generate a link to an entry.
array | $atts | { string $action What type of link to generate. Options: read , edit , and delete . Default: read string $view_id Define the ID for the View. If not set, use current View ID, if exists. string $entry_id ID of the entry to edit. If undefined, uses the current entry ID, if exists. string $post_id ID of the base post or page to use for an embedded View string $link_atts Pass anchor tag attributes (target=_blank to open Edit Entry link in a new window, for example) string $return What should the shortcode return: link HTML (html ) or the URL (url ). Default: html string $field_values Only used for action="edit" . Parameters to pass in to the prefill data in Edit Entry form. Uses the same format as Gravity Forms "Allow field to be populated dynamically" { |
string | null | $content | Used as link anchor text, if specified. |
string | $context | Current shortcode being called. Not used. |
<a>
HTML tag. Definition at line 63 of file class-gravityview-entry-link-shortcode.php.
References $content, and shortcode().
|
private |
Generate a link to an entry.
The link can be an edit, delete, or standard link.
array | $atts | { string $action What type of link to generate. Options: read , edit , and delete . Default: read string $view_id Define the ID for the View. If not set, use current View ID, if exists. string $entry_id ID of the entry to edit. If undefined, uses the current entry ID, if exists. string $post_id ID of the base post or page to use for an embedded View string $link_atts Pass anchor tag attributes (target=_blank to open Edit Entry link in a new window, for example) string $return What should the shortcode return: link HTML (html ) or the URL (url ). Default: html string $field_values Only used for action="edit" . Parameters to pass in to the prefill data in Edit Entry form. Uses the same format as Gravity Forms "Allow field to be populated dynamically" { |
string | null | $content | Used as link anchor text, if specified. |
string | $context | Current shortcode being called. Not used. |
<a>
HTML tag. gravityview/shortcodes/gv_entry_link/output
Modify the output of the [gv_entry_link] shortcode string | $return | The HTML link output |
array | { string $url The URL used to generate the anchor tag. { |
Definition at line 119 of file class-gravityview-entry-link-shortcode.php.
References $content, $link_atts, $link_text, $url, get_anchor_text(), get_entry(), get_link_atts(), get_url(), GravityView_View\getInstance(), gravityview(), gravityview_get_link(), and has_cap().
Referenced by delete_shortcode(), edit_shortcode(), and read_shortcode().
|
staticprivate |
array The accepted shortcode attribute pairs, with defaults set
Definition at line 28 of file class-gravityview-entry-link-shortcode.php.
|
private |
array Entry fetched using the $atts['entry_id'] shortcode setting.
Definition at line 16 of file class-gravityview-entry-link-shortcode.php.
Referenced by get_entry().
|
private |
array The final settings for the shortcode, after merging passed $atts with self::$defaults
Definition at line 42 of file class-gravityview-entry-link-shortcode.php.
|
private |
int If set, generate a link to the entry for this View ID.
Required when used outside a View. Otherwise, current View ID is used.
Definition at line 22 of file class-gravityview-entry-link-shortcode.php.