private function IpGeoLocPluginStyleLeaflet::addDefaultMarker in IP Geolocation Views & Maps 8
Form part definition.
1 call to IpGeoLocPluginStyleLeaflet::addDefaultMarker()
- IpGeoLocPluginStyleLeaflet::buildOptionsForm in src/
Plugin/ views/ style/ IpGeoLocPluginStyleLeaflet.php - Provide a form to edit options for this plugin.
File
- src/
Plugin/ views/ style/ IpGeoLocPluginStyleLeaflet.php, line 333
Class
- IpGeoLocPluginStyleLeaflet
- Views Style plugin extension for Leaflet (if enabled).
Namespace
Drupal\ip_geoloc\Plugin\views\styleCode
private function addDefaultMarker(&$form, &$weight) {
$path = drupal_get_path('module', 'ip_geoloc');
$desc1 = $this
->t('In addition to selecting a color, you may superimpose a special icon on top of each marker. <br><a target="fsymbols" href="!url_fsymbols">fsymbols</a> characters can be copied and pasted straight into the <strong>Font icon character</strong> field. Other libraries like <a target="fontawesome" href="!url_fontawesome">Font Awesome</a> and <a target="flaticon" href="!url_flaticon">flaticon</a> use names that you type in the <strong>Font icon class</strong> field.', [
// '!url_fsymbols' => url('http://fsymbols.com'),
// '!url_fontawesome' => url('http://fortawesome.github.io/Font-Awesome/cheatsheet'),
// '!url_flaticon' => url('http://flaticon.com'),
'!url_fsymbols' => 'http://fsymbols.com',
'!url_fontawesome' => 'http://fortawesome.github.io/Font-Awesome/cheatsheet',
'!url_flaticon' => 'http://flaticon.com',
]);
$desc2 = $this
->t('<em>fsymbols</em> require no further installation. For other libraries see the <a target="readme" href="!url_readme">README</a>.', [
// '!url_readme' => url("$path/README.txt"),.
'!url_readme' => "{$path}/README.txt",
]);
$desc3 = $this
->t('All this works best with the markers from the <em>/amarkers</em> directory, configurable <a target="config" href="!url_config">here</a>.', [
// '!url_config' => url('admin/config/system/ip_geoloc'),.
'!url_config' => 'admin/config/system/ip_geoloc',
]);
$form['default_marker'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Default marker style'),
'#description' => $desc1 . '<br/>' . $desc2 . '<br/>' . $desc3,
'#weight' => $weight++,
];
$form['default_marker']['default_marker_color'] = [
'#title' => $this
->t('Style/color'),
'#type' => 'select',
'#default_value' => $this->options['default_marker']['default_marker_color'],
'#options' => $this->ipGeolocGlobal
->markerColors(),
'#description' => $this
->t('Select an image to use for all location markers whose images are not overridden by the <strong>Location differentiator</strong> below.'),
'#attributes' => [
'class' => [
'marker-color',
],
],
];
$form['default_marker']['default_marker_special_char'] = [
'#title' => $this
->t('Font icon character'),
'#type' => 'textfield',
'#size' => 8,
'#default_value' => $this->options['default_marker']['default_marker_special_char'],
'#description' => $this
->t('Paste directly from <a target="fsymbols" href="!url_fsymbols">fsymbols</a>. If the character displays in color or as a square then it may not save or display correctly.', [
'!url_fsymbols' => 'http://text-symbols.com',
]),
];
$desc4 = $this
->t('Use the class name from the font icon library you are using. Append <strong>light</strong>, <strong>dark</strong> or <strong>red</strong> to change the color. Examples:<br/>Font Awesome: <strong>fa fa-beer light</strong><br/>flaticon: <strong>flaticon-bicycle12 red</strong>');
$form['default_marker']['default_marker_special_char_class'] = [
'#title' => $this
->t('Font icon class'),
'#type' => 'textfield',
'#size' => 25,
'#default_value' => $this->options['default_marker']['default_marker_special_char_class'],
'#description' => $desc4,
];
}