cf7_style_frontend_edit_link

Frontend edit link.

Description

cf7_style_frontend_edit_link( $form ); 

Parameters (1)

0. $form
The form.

Usage

  1. if ( !function_exists( 'cf7_style_frontend_edit_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-style/cf7-style.php'; 
  3.  
  4. // The form. 
  5. $form = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = cf7_style_frontend_edit_link($form); 
  9.  

Defined (1)

The function is defined in the following location(s).

/cf7-style.php  
  1. function cf7_style_frontend_edit_link( $form ) { 
  2.  
  3. if( is_user_logged_in() && current_user_can( 'manage_options' ) && !is_admin() && get_option( 'cf7_style_form_tooltip' ) == 1 ) { 
  4.  
  5. $cf7 = wpcf7_get_current_contact_form(); // Current contact form 7 object 
  6. $form_id = get_form_id( $cf7 ); 
  7. $cf7_style_id = get_post_meta( $form_id, 'cf7_style_id', true ); 
  8.  
  9. if( empty( $cf7_style_id ) ) { 
  10. $form .= "<a href='" . admin_url( 'edit.php?post_type=cf7_style' ) . "' class='frontend-edit-style-link'>" . __( 'Add Style', 'contact-form-7-style' ) . "</a>"; 
  11. } else { 
  12. $cf7_style_data = get_post( $cf7_style_id, OBJECT ); 
  13. $template_type = ( has_term( 'custom-style', 'style_category', $cf7_style_data ) ) ? __( 'Edit custom style', 'contact-form-7-style' ) : __( 'Edit predifined template', 'contact-form-7-style' ); 
  14. $form .= "<a href='" . admin_url( 'post.php?post=' . $cf7_style_id . '&action=edit' ) . "' class='frontend-edit-style-link'>" . $template_type . "</a>";  
  15.  
  16. return $form;