elementor / elementor/one-click-accessibility

Request : Make the possibility to put the toggle logo that opens the toolbar in the menu

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
95
Forks
43
Avg merge
3d 23h
Merged PRs (30d)
2

Description

I would love the possibility for the user to choose the options menu-left or menu-right that changes the positions of the toggle that oppens the toolbar and add it directly in the WP menu

For example you can add 2 new positions in the accessibility section of wordpress (appareance/customize/accessibilty (menu-left and menu-right)
I tried to code but only did that im stuck and i was wondering if you have any idea of how to continue ?

```
File : pojo-a11y-customizer.php

class Pojo_A11y_Customizer {
private $css_rules = array();
private $css_code = '';

public function get_customizer_fields() {
$fields = array();

$fields[] = array(
'id' => 'a11y_toolbar_icon',
'title' => __( 'Toolbar Icon', 'pojo-accessibility' ),
'type' => 'select',
'choices' => array(
'one-click' => __( 'One Click', 'pojo-accessibility' ),
'wheelchair' => __( 'Wheelchair', 'pojo-accessibility' ),
'accessibility' => __( 'Accessibility', 'pojo-accessibility' ),
),
'std' => 'one-click',
'description' => __( 'Set Toolbar Icon', 'pojo-accessibility' ),
);

$fields[] = array(
'id' => 'a11y_toolbar_position',
'title' => __( 'Toolbar Position', 'pojo-accessibility' ),
'type' => 'select',
'choices' => array(
'left' => __( 'Left', 'pojo-accessibility' ),
'right' => __( 'Right', 'pojo-accessibility' ),
'menu-left' => __( 'Menu Left', 'pojo-accessibility' ), //New option to add toolbar in the menu to the left
'menu-right' => __( 'Menu Right', 'pojo-accessibility' ), // Same but for the right
),
'std' => is_rtl() ? 'right' : 'left',
'description' => __( 'Set Toolbar Position', 'pojo-accessibility' ),
);
// The rest of the code

```

```
The file : pojo-a11y-frontend.php

public function print_toolbar()
{
if (!$this->is_toolbar_active()) {
return;
}

$customizer_options = get_option(POJO_A11Y_CUSTOMIZER_OPTIONS);

$toolbar_position = $customizer_options['a11y_toolbar_position'];
if (empty($toolbar_position) || !in_array($toolbar_position, array('right', 'left', 'menu-left', 'menu-right'))) {
$toolbar_position = 'left';
}

$toolbar_title = Pojo_Accessibility::$instance->settings->get_default_title_text('pojo_a11y_toolbar_title');
$toolbar_visibility = get_option('pojo_a11y_toolbar');

$wrapper_classes = array(
'pojo-a11y-toolbar-' . $toolbar_position,
);

if ('enable' !== $toolbar_visibility) {
$wrapper_classes[] = 'pojo-a11y-' . $toolbar_visibility;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.