Backstretch Headway block – 05

Moving code

I’ve refactored the plugin a bit and moved the code bloating the htbackstretch\Main class into the htbackstretch\Butler class. The name might not be the best one but I could not find a better one. Strict object-oriented programming suggests that if a name for a class does not come up in 5 seconds or less then the class has too many responsibilities but still ThemeUserOptionAndThemeDeveloperSettingUser did not seem a better choice.
The refactored code, to a point, is released on GitHub.

Fine grain control for the theme developer

I really do not like super-charging interfaces or applications but felt like giving the theme developer a little more control over the duration of the slider-like effect and the fading times did add little in terms of complications while still allowing for some control. [caption id=“attachment_863” align=“aligncenter” width=“1024”]Sliders Sliders to control a slider-like effect.[/caption] I’ve found out that the built-in slider control Headway will render on the visual editor panels is too strict to show 3 or 4 digits numbers: the screenshot above is the effect of a little style injection I’ve put in the htbackstretch\Main class

// register this block theme-wide settings
VEPanel::on(__NAMESPACE__ . '\VisualEditorPanel');

// along with the visual editor panel load a litte style to
// fix the slider width
add_action('headway_visual_editor_styles', function (){
    echo sprintf('<style>%s {width:%dpx;}</style>', 'input[id*="input-general-htbackstretch-"]', 30);

The non modified sliders, here used to set a millisecond value, would look like [caption id=“attachment_864” align=“aligncenter” width=“1024”]Too small Too small[/caption]

No block at all

In the end I’ve removed the htbackstretch\Block and htbackstretch\BlockOptions classes as what I’ve developed is no block at all: it’s an “Headway plugin” and really no block can be added to the theme layouts using it.

It’s done

Aside for bug-fixing and a little more love for the labels, they’re too long, I call it done. The plugin offers me all the features I need for the project at hand and does so in a re-usable way.
The plugin can be seen in action in this video