Completed
Pull Request — develop (#1620)
by Zack
15:37
created
includes/class-admin-views.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -62,28 +62,28 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	/**
65
-     * When on the Add/Edit View screen, suggest most popular articles related to that
66
-     *
65
+	 * When on the Add/Edit View screen, suggest most popular articles related to that
66
+	 *
67 67
 	 * @param array $localization_data Data to be passed to the Support Port JS
68 68
 	 *
69 69
 	 * @return array
70 70
 	 */
71 71
 	function suggest_support_articles( $localization_data = array() ) {
72 72
 
73
-	    if( ! gravityview()->request->is_view() ) {
74
-	        return $localization_data;
75
-        }
73
+		if( ! gravityview()->request->is_view() ) {
74
+			return $localization_data;
75
+		}
76 76
 
77 77
 		$localization_data['suggest'] = array(
78
-            '57ef23539033602e61d4a560',
79
-            '54c67bb9e4b0512429885513',
80
-            '54c67bb9e4b0512429885512',
81
-            '54c67bbbe4b07997ea3f3f6b',
82
-            '54d1a33ae4b086c0c0964ce9',
83
-            '57ef253c9033602e61d4a563',
84
-            '552355bfe4b0221aadf2572b',
85
-            '54c67bcde4b051242988553e',
86
-        );
78
+			'57ef23539033602e61d4a560',
79
+			'54c67bb9e4b0512429885513',
80
+			'54c67bb9e4b0512429885512',
81
+			'54c67bbbe4b07997ea3f3f6b',
82
+			'54d1a33ae4b086c0c0964ce9',
83
+			'57ef253c9033602e61d4a563',
84
+			'552355bfe4b0221aadf2572b',
85
+			'54c67bcde4b051242988553e',
86
+		);
87 87
 
88 88
 		return $localization_data;
89 89
 	}
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 
230 230
 		if( 'form_list' === GFForms::get_page() ) {
231 231
 			$priority = 790;
232
-        }
232
+		}
233 233
 
234 234
 		if( empty( $connected_views ) ) {
235 235
 
236
-		    $menu_items['gravityview'] = array(
236
+			$menu_items['gravityview'] = array(
237 237
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
238 238
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5
239 239
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 		// If there were no items added, then let's create the parent menu
266 266
 		if( $sub_menu_items ) {
267 267
 
268
-		    $sub_menu_items[] = array(
269
-			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
270
-			    'icon' => '<span class="dashicons dashicons-plus"></span>',
271
-			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
272
-			    'url'   => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ),
273
-			    'capabilities'   => array( 'edit_gravityviews' ),
274
-            );
268
+			$sub_menu_items[] = array(
269
+				'label' => esc_attr__( 'Create a View', 'gravityview' ),
270
+				'icon' => '<span class="dashicons dashicons-plus"></span>',
271
+				'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
272
+				'url'   => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ),
273
+				'capabilities'   => array( 'edit_gravityviews' ),
274
+			);
275 275
 
276 276
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
277 277
 			$sub_menu_items[] = array(
@@ -653,16 +653,16 @@  discard block
 block discarded – undo
653 653
 	/**
654 654
 	 * Render html for displaying available fields based on a Form ID
655 655
 	 *
656
-     * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action
656
+	 * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action
657 657
 	 *
658 658
 	 * @param int $form Gravity Forms Form ID (default: '')
659 659
 	 * @param string $context (default: 'single')
660
-     *
660
+	 *
661 661
 	 * @return void
662 662
 	 */
663 663
 	function render_available_fields( $form = 0, $context = 'single' ) {
664 664
 
665
-	    // Determine if form is a preset and convert it to an array with fields
665
+		// Determine if form is a preset and convert it to an array with fields
666 666
 		$form = ( is_string( $form ) && preg_match( '/^preset_/', $form ) ) ? GravityView_Ajax::pre_get_form_fields( $form ) : $form;
667 667
 
668 668
 		/**
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 		if ( ! is_array( $blacklist_field_types ) ) {
676 676
 
677
-		    gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) );
677
+			gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) );
678 678
 
679 679
 			$blacklist_field_types = array();
680 680
 		}
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 
933 933
 				$joined_forms = gravityview_get_joined_forms( $post->ID );
934 934
 
935
-                foreach ( $joined_forms as $form ) {
936
-                    $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone );
937
-                }
935
+				foreach ( $joined_forms as $form ) {
936
+					$available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone );
937
+				}
938 938
 			} else {
939 939
 				$available_items[ $form ] = \GV\Widget::registered();
940 940
 			}
@@ -973,9 +973,9 @@  discard block
 block discarded – undo
973 973
 
974 974
 										if ( $form_id ) {
975 975
 											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
976
-                                        } else {
976
+										} else {
977 977
 											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
978
-                                        }
978
+										}
979 979
 
980 980
 										if ( !$original_item ) {
981 981
 											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 		}
1226 1226
 
1227 1227
 		// Add the GV font (with the Astronaut)
1228
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1228
+		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1229 1229
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1230 1230
 
1231 1231
 		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
@@ -1233,46 +1233,46 @@  discard block
 block discarded – undo
1233 1233
 		if( GFForms::get_page() === 'form_list' ) {
1234 1234
 			wp_enqueue_style( 'gravityview_views_styles' );
1235 1235
 			return;
1236
-        }
1236
+		}
1237 1237
 
1238 1238
 		// Don't process any scripts below here if it's not a GravityView page.
1239 1239
 		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1240
-		    return;
1240
+			return;
1241 1241
 		}
1242 1242
 
1243 1243
 		wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
1244 1244
 
1245
-        wp_enqueue_script( 'jquery-ui-datepicker' );
1246
-
1247
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1248
-
1249
-        // Enqueue scripts
1250
-        wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version );
1251
-
1252
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1253
-            'cookiepath' => COOKIEPATH,
1254
-            'admin_cookiepath' => ADMIN_COOKIE_PATH,
1255
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1256
-            'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1257
-            'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1258
-            'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ),
1259
-            'label_add_search_field' => __( 'Add Search Field', 'gravityview' ),
1260
-            'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ),
1261
-            'label_close' => __( 'Close', 'gravityview' ),
1262
-            'label_cancel' => __( 'Cancel', 'gravityview' ),
1263
-            'label_continue' => __( 'Continue', 'gravityview' ),
1264
-            'label_ok' => __( 'Ok', 'gravityview' ),
1265
-            'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ),
1266
-            'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
1267
-            'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1268
-            'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1269
-            'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ),
1270
-        ));
1245
+		wp_enqueue_script( 'jquery-ui-datepicker' );
1246
+
1247
+		wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1248
+
1249
+		// Enqueue scripts
1250
+		wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version );
1251
+
1252
+		wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1253
+			'cookiepath' => COOKIEPATH,
1254
+			'admin_cookiepath' => ADMIN_COOKIE_PATH,
1255
+			'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1256
+			'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1257
+			'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1258
+			'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ),
1259
+			'label_add_search_field' => __( 'Add Search Field', 'gravityview' ),
1260
+			'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ),
1261
+			'label_close' => __( 'Close', 'gravityview' ),
1262
+			'label_cancel' => __( 'Cancel', 'gravityview' ),
1263
+			'label_continue' => __( 'Continue', 'gravityview' ),
1264
+			'label_ok' => __( 'Ok', 'gravityview' ),
1265
+			'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ),
1266
+			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
1267
+			'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1268
+			'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1269
+			'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ),
1270
+		));
1271 1271
 
1272 1272
 		wp_enqueue_style( 'gravityview_views_styles' );
1273 1273
 
1274
-        // Enqueue scripts needed for merge tags
1275
-        self::enqueue_gravity_forms_scripts();
1274
+		// Enqueue scripts needed for merge tags
1275
+		self::enqueue_gravity_forms_scripts();
1276 1276
 
1277 1277
 		// 2.5 changed how Merge Tags are enqueued
1278 1278
 		if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) {
@@ -1282,24 +1282,24 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 	/**
1284 1284
 	 * Enqueue Gravity Forms scripts, needed for Merge Tags
1285
-     *
1286
-     * @since 1.0.5-beta
1287
-     *
1288
-     * @return void
1285
+	 *
1286
+	 * @since 1.0.5-beta
1287
+	 *
1288
+	 * @return void
1289 1289
 	 */
1290 1290
 	static function enqueue_gravity_forms_scripts() {
1291 1291
 		GFForms::register_scripts();
1292 1292
 
1293 1293
 		$scripts = array(
1294
-		    'sack',
1295
-		    'gform_gravityforms',
1296
-		    'gform_forms',
1297
-		    'gform_form_admin',
1298
-		    'jquery-ui-autocomplete'
1294
+			'sack',
1295
+			'gform_gravityforms',
1296
+			'gform_forms',
1297
+			'gform_form_admin',
1298
+			'jquery-ui-autocomplete'
1299 1299
 		);
1300 1300
 
1301 1301
 		if ( wp_is_mobile() ) {
1302
-		    $scripts[] = 'jquery-touch-punch';
1302
+			$scripts[] = 'jquery-touch-punch';
1303 1303
 		}
1304 1304
 
1305 1305
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 1 patch
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -10,42 +10,42 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13
-    die;
13
+	die;
14 14
 }
15 15
 
16 16
 
17 17
 class GravityView_Edit_Entry_Admin {
18 18
 
19
-    protected $loader;
19
+	protected $loader;
20 20
 
21
-    function __construct( GravityView_Edit_Entry $loader ) {
22
-        $this->loader = $loader;
23
-    }
21
+	function __construct( GravityView_Edit_Entry $loader ) {
22
+		$this->loader = $loader;
23
+	}
24 24
 
25
-    function load() {
25
+	function load() {
26 26
 
27
-        if( !is_admin() ) {
28
-            return;
29
-        }
27
+		if( !is_admin() ) {
28
+			return;
29
+		}
30 30
 
31
-        // Add Edit Link as a default field, outside those set in the Gravity Form form
32
-        add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
31
+		// Add Edit Link as a default field, outside those set in the Gravity Form form
32
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33 33
 
34
-        // For the Edit Entry Link, you don't want visible to all users.
35
-        add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
34
+		// For the Edit Entry Link, you don't want visible to all users.
35
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
36 36
 
37
-        // Modify the field options based on the name of the field type
38
-        add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
37
+		// Modify the field options based on the name of the field type
38
+		add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40
-        // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
40
+		// add tooltips
41
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42 42
 
43
-        // custom fields' options for zone EDIT
44
-        add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
43
+		// custom fields' options for zone EDIT
44
+		add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
45 45
 
46
-        // Add Edit Entry settings to View Settings
47
-        add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
-    }
46
+		// Add Edit Entry settings to View Settings
47
+		add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * Render Edit Entry View metabox settings
@@ -73,109 +73,109 @@  discard block
 block discarded – undo
73 73
 		GravityView_Render_Settings::render_setting_row( 'action_label_cancel', $current_settings );
74 74
 	}
75 75
 
76
-    /**
77
-     * Add Edit Link as a default field, outside those set in the Gravity Form form
78
-     * @param array $entry_default_fields Existing fields
79
-     * @param  string|array $form form_ID or form object
80
-     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
81
-     */
82
-    function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
83
-
84
-        if( $zone !== 'edit' ) {
85
-
86
-            $entry_default_fields['edit_link'] = array(
87
-                'label' => __('Link to Edit Entry', 'gravityview'),
88
-                'type' => 'edit_link',
89
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
90
-                'icon' => 'dashicons-welcome-write-blog',
91
-            );
92
-
93
-        }
94
-
95
-        return $entry_default_fields;
96
-    }
97
-
98
-    /**
99
-     * Change wording for the Edit context to read Entry Creator
100
-     *
101
-     * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
102
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
103
-     * @param  string      $template_id Table slug
104
-     * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
105
-     * @param  string      $context     What context are we in? Example: `single` or `directory`
106
-     * @param  string      $input_type  (textarea, list, select, etc.)
107
-     * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
108
-     */
109
-    function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
110
-
111
-        $caps = $visibility_caps;
112
-
113
-        // If we're configuring fields in the edit context, we want a limited selection
114
-        if( $context === 'edit' ) {
115
-
116
-            // Remove other built-in caps.
117
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
118
-
119
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
120
-        }
121
-
122
-        return $caps;
123
-    }
124
-
125
-    /**
126
-     * Add "Edit Link Text" setting to the edit_link field settings
127
-     *
128
-     * @param array  $field_options
129
-     * @param string $template_id
130
-     * @param string $field_id
131
-     * @param string $context
132
-     * @param string $input_type
133
-     *
134
-     * @return array $field_options, with "Edit Link Text" field option
135
-     */
136
-    function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
137
-
138
-        // Always a link, never a filter
139
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
140
-
141
-        // Edit Entry link should only appear to visitors capable of editing entries
142
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
143
-
144
-        $add_option['edit_link'] = array(
145
-            'type' => 'text',
146
-            'label' => __( 'Edit Link Text', 'gravityview' ),
147
-            'desc' => NULL,
148
-            'value' => __('Edit Entry', 'gravityview'),
149
-            'merge_tags' => true,
150
-        );
151
-
152
-	    $add_option['new_window'] = array(
153
-		    'type' => 'checkbox',
154
-		    'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
155
-		    'value' => false,
156
-		    'group' => 'display',
157
-		    'priority' => 1300,
158
-	    );
159
-
160
-        return array_merge( $add_option, $field_options );
161
-    }
162
-
163
-    /**
164
-     * Add tooltips
165
-     * @param  array $tooltips Existing tooltips
166
-     * @return array           Modified tooltips
167
-     */
168
-    function tooltips( $tooltips ) {
169
-
170
-        $return = $tooltips;
171
-
172
-        $return['allow_edit_cap'] = array(
173
-            'title' => __('Limiting Edit Access', 'gravityview'),
174
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
175
-        );
176
-
177
-        return $return;
178
-    }
76
+	/**
77
+	 * Add Edit Link as a default field, outside those set in the Gravity Form form
78
+	 * @param array $entry_default_fields Existing fields
79
+	 * @param  string|array $form form_ID or form object
80
+	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
81
+	 */
82
+	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
83
+
84
+		if( $zone !== 'edit' ) {
85
+
86
+			$entry_default_fields['edit_link'] = array(
87
+				'label' => __('Link to Edit Entry', 'gravityview'),
88
+				'type' => 'edit_link',
89
+				'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
90
+				'icon' => 'dashicons-welcome-write-blog',
91
+			);
92
+
93
+		}
94
+
95
+		return $entry_default_fields;
96
+	}
97
+
98
+	/**
99
+	 * Change wording for the Edit context to read Entry Creator
100
+	 *
101
+	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
102
+	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
103
+	 * @param  string      $template_id Table slug
104
+	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
105
+	 * @param  string      $context     What context are we in? Example: `single` or `directory`
106
+	 * @param  string      $input_type  (textarea, list, select, etc.)
107
+	 * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
108
+	 */
109
+	function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
110
+
111
+		$caps = $visibility_caps;
112
+
113
+		// If we're configuring fields in the edit context, we want a limited selection
114
+		if( $context === 'edit' ) {
115
+
116
+			// Remove other built-in caps.
117
+			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
118
+
119
+			$caps['read'] = _x('Entry Creator','User capability', 'gravityview');
120
+		}
121
+
122
+		return $caps;
123
+	}
124
+
125
+	/**
126
+	 * Add "Edit Link Text" setting to the edit_link field settings
127
+	 *
128
+	 * @param array  $field_options
129
+	 * @param string $template_id
130
+	 * @param string $field_id
131
+	 * @param string $context
132
+	 * @param string $input_type
133
+	 *
134
+	 * @return array $field_options, with "Edit Link Text" field option
135
+	 */
136
+	function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
137
+
138
+		// Always a link, never a filter
139
+		unset( $field_options['show_as_link'], $field_options['search_filter'] );
140
+
141
+		// Edit Entry link should only appear to visitors capable of editing entries
142
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
143
+
144
+		$add_option['edit_link'] = array(
145
+			'type' => 'text',
146
+			'label' => __( 'Edit Link Text', 'gravityview' ),
147
+			'desc' => NULL,
148
+			'value' => __('Edit Entry', 'gravityview'),
149
+			'merge_tags' => true,
150
+		);
151
+
152
+		$add_option['new_window'] = array(
153
+			'type' => 'checkbox',
154
+			'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
155
+			'value' => false,
156
+			'group' => 'display',
157
+			'priority' => 1300,
158
+		);
159
+
160
+		return array_merge( $add_option, $field_options );
161
+	}
162
+
163
+	/**
164
+	 * Add tooltips
165
+	 * @param  array $tooltips Existing tooltips
166
+	 * @return array           Modified tooltips
167
+	 */
168
+	function tooltips( $tooltips ) {
169
+
170
+		$return = $tooltips;
171
+
172
+		$return['allow_edit_cap'] = array(
173
+			'title' => __('Limiting Edit Access', 'gravityview'),
174
+			'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
175
+		);
176
+
177
+		return $return;
178
+	}
179 179
 
180 180
 	/**
181 181
 	 * Add "Edit Link Text" setting to the edit_link field settings
@@ -191,28 +191,28 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
193 193
 
194
-        // We only want to modify the settings for the edit context
195
-        if( 'edit' !== $context ) {
196
-            return $field_options;
197
-        }
198
-
199
-        //  Entry field is only for logged in users
200
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
201
-
202
-        $add_options = array(
203
-            'allow_edit_cap' => array(
204
-                'type' => 'select',
205
-                'label' => __( 'Make field editable to:', 'gravityview' ),
206
-                'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
207
-                'tooltip' => 'allow_edit_cap',
208
-                'class' => 'widefat',
209
-                'value' => 'read', // Default: entry creator
210
-                'group' => 'visibility',
211
-            ),
212
-        );
213
-
214
-        return array_merge( $field_options, $add_options );
215
-    }
194
+		// We only want to modify the settings for the edit context
195
+		if( 'edit' !== $context ) {
196
+			return $field_options;
197
+		}
198
+
199
+		//  Entry field is only for logged in users
200
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
201
+
202
+		$add_options = array(
203
+			'allow_edit_cap' => array(
204
+				'type' => 'select',
205
+				'label' => __( 'Make field editable to:', 'gravityview' ),
206
+				'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
207
+				'tooltip' => 'allow_edit_cap',
208
+				'class' => 'widefat',
209
+				'value' => 'read', // Default: entry creator
210
+				'group' => 'visibility',
211
+			),
212
+		);
213
+
214
+		return array_merge( $field_options, $add_options );
215
+	}
216 216
 
217 217
 
218 218
 } // end class
Please login to merge, or discard this patch.
includes/extensions/edit-entry/partials/form-buttons.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 <div id="publishing-action">
21 21
 	<?php
22 22
 
23
-    /**
24
-     * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
25
-     * @since 1.11.1
26
-     * @param string $back_link Existing URL of the Cancel link
27
-     * @param array $form The Gravity Forms form
28
-     * @param array $entry The Gravity Forms entry
29
-     * @param int $view_id The current View ID
30
-     */
31
-    $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
23
+	/**
24
+	 * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
25
+	 * @since 1.11.1
26
+	 * @param string $back_link Existing URL of the Cancel link
27
+	 * @param array $form The Gravity Forms form
28
+	 * @param array $entry The Gravity Forms entry
29
+	 * @param int $view_id The current View ID
30
+	 */
31
+	$back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
32 32
 
33 33
 	/**
34 34
 	 * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 * @used-by GravityView_Delete_Entry::add_delete_button()
75 75
 	 *
76 76
 	 * @since 1.5.1
77
-     * @since 2.0.13 Added $post_id
77
+	 * @since 2.0.13 Added $post_id
78 78
 	 * @param array $form The Gravity Forms form
79 79
 	 * @param array $entry The Gravity Forms entry
80 80
 	 * @param int $view_id The current View ID
81
-     * @param int $post_id The current Post ID
81
+	 * @param int $post_id The current Post ID
82 82
 	 */
83 83
 	do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id );
84 84
 
Please login to merge, or discard this patch.