Skip to content

Commit f9713ee

Browse files
committed
Use short name as placeholder
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 8787b24 commit f9713ee

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

event/listener.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function acp_pwa_options($event)
160160

161161
$my_config_vars = [
162162
'legend_pwa_settings'=> 'PWA_SETTINGS',
163-
'pwa_short_name' => ['lang' => 'PWA_SHORT_NAME', 'validate' => 'string', 'type' => 'text:40:12', 'explain' => true],
163+
'pwa_short_name' => ['lang' => 'PWA_SHORT_NAME', 'validate' => 'string', 'type' => 'custom', 'function' => [$this, 'pwa_short_sitename'], 'explain' => true],
164164
'pwa_icon_small' => ['lang' => 'PWA_ICON_SMALL', 'validate' => 'pwa_options', 'type' => 'custom', 'function' => [$this, 'pwa_icon_name'], 'explain' => true],
165165
'pwa_icon_large' => ['lang' => 'PWA_ICON_LARGE', 'validate' => 'pwa_options', 'type' => 'custom', 'function' => [$this, 'pwa_icon_name'], 'explain' => true],
166166
];
@@ -181,6 +181,20 @@ public function pwa_icon_name($value, $key)
181181
return $this->config['icons_path'] . '/<input id="' . $key . '" type="text" size="40" maxlength="255" name="config[' . $key . ']" value="' . $value . '">';
182182
}
183183

184+
/**
185+
* Return HTML for PWA short site name setting
186+
*
187+
* @param string $value Value of config
188+
* @param string $key Name of config
189+
* @return string
190+
*/
191+
public function pwa_short_sitename($value, $key)
192+
{
193+
$placeholder = $this->get_shortname($this->config['sitename']);
194+
195+
return '<input id="' . $key . '" type="text" size="40" maxlength="255" name="config[' . $key . ']" value="' . $value . '" placeholder="' . $placeholder . '">';
196+
}
197+
184198
/**
185199
* Validate PWA options
186200
*

0 commit comments

Comments
 (0)