The Advantage of Using "getString" in tabs array?
Permalink
Hey block dev's, when I'm setting up tabs in my block form.php, whats the advantage of using the getString method over just static typing the names?
Example, the way I've been doing it:
And the way I've been seeing the more experienced developers doing it:
Why do they use getString to generate the class names?
Example, the way I've been doing it:
And the way I've been seeing the more experienced developers doing it:
$getString = Core::make('helper/validation/identifier')->getString(18); $tabs = array( array('form-items-' . $getString, t('Items'), true), array('form-options-' . $getString, t('Options')), array('form-layout-' . $getString, t('Layout')), array('form-colors-padding-' . $getString, t('Colors and Padding')), ); echo Core::make('helper/concrete/ui')->tabs($tabs);
Why do they use getString to generate the class names?
Dunno; possibly to ensure that every identifier will be unique on a page, even if multiple instances of the block are on it.
But even when you have multiple blocks on the same page, only one edit form can be open at a time, therefore I don't see that being an advantage...
For composer?
Brilliant!