Hube2 / acf-medium-editor

Configurable Medium Editor WYSIWYG Field for ACF5 Pro
77 stars 10 forks source link

Remove parentheses from informational message. #19

Closed louiswalch closed 6 years ago

louiswalch commented 6 years ago

It would be nice if the ()'s were either part of the language string, or the entire thing was wrapped with a filter. I'd like to have full control over what is included below the editor.

acf-medium-editor-v5_php_ _woocommerce__in-the-pursuit__aiany__new-york-vintage__public-art-fund__the-future-perfect

Hube2 commented 6 years ago

Thanks for the suggestion. I will look at making this change as soon as I have time.

louiswalch commented 6 years ago

Cool. In the meantime, for anyone wanting to remove them I did it with a little hacky CSS.

    // ---------------------------------------------------------------------------
    // ACF : Medium Field : Change the message displayed below editor, and then make it look better.

    add_filter('gettext', function( $translated_text, $untranslated_text, $domain ) {
        if ($translated_text == 'select text for formatting options') {
            $translated_text = '<span>Highlight text to format — For single line break, use SHIFT+RETURN.</span>';
        }
        return $translated_text;

    }, 20, 3);

    // ---------------------------------------------------------------------------
    // ACF : Medium Field : Remove the parentheses from message.

    add_action('admin_head', function() {
        echo '<style>'
            .'.acf-field-medium-editor .acf-input > SPAN { color: white; } '
            .'.acf-field-medium-editor .acf-input > SPAN SPAN { font-style: normal; font-size: 10px; color: #666; position: relative; left: -4px; }'
            .'</style>';
    });
Hube2 commented 6 years ago

For the version here I have added the () into the string to be translated. I have also added a filter so that you can alter this text to whatever you want. Here's the line from my code $e .= '<span>'.apply_filters('acf-medium-editor/field-instructions', __('(select text for formatting options)', 'acf-medium-editor')).'</span>';

Hube2 commented 6 years ago

I have not updated this to wordpress.org yet. I'm going to wait a couple of days and see if the person that did the one translation sends me and update first.