@@ -78,34 +78,22 @@ public static function get_settings_list() {
78
78
79
79
return [
80
80
[
81
- 'label ' => __ ( 'Default Sponsor Byline Prefix ' , 'newspack-sponsors ' ),
82
- 'placeholder ' => sprintf (
83
- // Translators: placeholder for default byline value.
84
- __ ( 'Default: “%s” ' , 'newspack-sponsors ' ),
85
- $ defaults ['byline ' ]
86
- ),
87
- 'key ' => 'newspack_sponsors_default_byline ' ,
88
- 'type ' => 'input ' ,
81
+ 'label ' => __ ( 'Default Sponsor Byline Prefix ' , 'newspack-sponsors ' ),
82
+ 'value ' => $ defaults ['byline ' ],
83
+ 'key ' => 'newspack_sponsors_default_byline ' ,
84
+ 'type ' => 'input ' ,
89
85
],
90
86
[
91
- 'label ' => __ ( 'Default Sponsored Flag Label ' , 'newspack-sponsors ' ),
92
- 'placeholder ' => sprintf (
93
- // Translators: placeholder for default flag value.
94
- __ ( 'Default: “%s” ' , 'newspack-sponsors ' ),
95
- $ defaults ['flag ' ]
96
- ),
97
- 'key ' => 'newspack_sponsors_default_flag ' ,
98
- 'type ' => 'input ' ,
87
+ 'label ' => __ ( 'Default Sponsored Flag Label ' , 'newspack-sponsors ' ),
88
+ 'value ' => $ defaults ['flag ' ],
89
+ 'key ' => 'newspack_sponsors_default_flag ' ,
90
+ 'type ' => 'input ' ,
99
91
],
100
92
[
101
- 'label ' => __ ( 'Default Sponsorship Disclaimer ' , 'newspack-sponsors ' ),
102
- 'placeholder ' => sprintf (
103
- // Translators: placeholder for default disclaimer value.
104
- __ ( 'Default: “%s” ' , 'newspack-sponsors ' ),
105
- $ defaults ['disclaimer ' ]
106
- ),
107
- 'key ' => 'newspack_sponsors_default_disclaimer ' ,
108
- 'type ' => 'textarea ' ,
93
+ 'label ' => __ ( 'Default Sponsorship Disclaimer ' , 'newspack-sponsors ' ),
94
+ 'value ' => $ defaults ['disclaimer ' ],
95
+ 'key ' => 'newspack_sponsors_default_disclaimer ' ,
96
+ 'type ' => 'textarea ' ,
109
97
],
110
98
];
111
99
}
@@ -174,25 +162,22 @@ public static function page_init() {
174
162
* @param array $setting Settings array.
175
163
*/
176
164
public static function newspack_sponsors_settings_callback ( $ setting ) {
177
- $ key = $ setting ['key ' ];
178
- $ type = $ setting ['type ' ];
179
- $ placeholder = $ setting ['placeholder ' ];
180
- $ value = get_option ( $ key , false );
165
+ $ key = $ setting ['key ' ];
166
+ $ type = $ setting ['type ' ];
167
+ $ value = ( '' !== get_option ( $ key , false ) ) ? get_option ( $ key , false ) : $ setting ['value ' ];
181
168
182
169
if ( 'textarea ' === $ type ) {
183
170
printf (
184
- '<textarea id="%s" name="%s" class="widefat" rows="4" placeholder="%s" >%s</textarea> ' ,
171
+ '<textarea id="%s" name="%s" class="widefat" rows="4">%s</textarea> ' ,
185
172
esc_attr ( $ key ),
186
173
esc_attr ( $ key ),
187
- esc_attr ( $ placeholder ),
188
174
esc_attr ( $ value )
189
175
);
190
176
} else {
191
177
printf (
192
- '<input type="text" id="%s" name="%s" placeholder="%s" value="%s" class="widefat" /> ' ,
178
+ '<input type="text" id="%s" name="%s" value="%s" class="widefat" /> ' ,
193
179
esc_attr ( $ key ),
194
180
esc_attr ( $ key ),
195
- esc_attr ( $ placeholder ),
196
181
esc_attr ( $ value )
197
182
);
198
183
}
0 commit comments