/**
* Returns the remote post links in form of up to three link elements, or a select element for more than three
* links.
*
* @param string $selections 'option' or 'a' elements.
* @param string $type 'links' or 'form'.
* @param array $translated Original array of translated posts, passed to the filter.
* @param string $position Quicklink position.
*
* @return string
*/
protected function get_html_container($selections, $type, $translated, $position)
{
$class_inner = 'mlp_inner';
$label_text = esc_html_x('Read in:', 'Quicklink label', 'multilingual-press');
if ('links' === $type) {
$html = <<<HTML
<div class="mlp-quicklinks mlp-quicklink-links {$position} mlp_quicklinks mlp_quicklinks_links">
\t<div class="{$class_inner}">
\t\t{$label_text}<br>
\t\t{$selections}
\t</div>
</div>
HTML;
} else {
$home_url = home_url();
$home_url = esc_attr($home_url);
$select_id = 'mlp-quicklink-select';
$select_name = 'mlp_quicklink_select';
$submit_text = esc_attr_x('Go', 'quicklink submit button', 'multilingual-press');
$html = <<<HTML
<form action="{$home_url}" method="post" class="mlp-quicklinks mlp-quicklink-form {$position} mlp_quicklinks mlp_quicklinks_form">
\t<div class="{$class_inner}">
\t\t<label for="{$select_id}">
\t\t\t{$label_text}
\t\t\t<select name="{$select_name}" id="{$select_id}" autocomplete="off">
\t\t\t\t{$selections}
\t\t\t</select>
\t\t</label>
\t\t<input type="submit" value="{$submit_text}">
\t</div>
</form>
HTML;
$this->asset_manager->enqueue_script('multilingualpress');
}
/**
* Filters the quicklinks HTML.
*
* @param string $html HTML output.
* @param string $type Quicklink type, 'links' or 'form'.
* @param array $translated Array of translated posts.
* @param string $selections Selections, 'option' or 'a' elements.
* @param string $position Quicklink position.
*/
return (string) apply_filters('mlp_quicklinks_html', $html, $type, $translated, $selections, $position);
}