Closed mahotilo closed 4 years ago
BTW, about real estate in the editing panel. I use this little trick to hide some editing settings if they are disabled. This helps me to escape scrolling.
// value 'telegram' --start
'telegram' => array(
'label' => $editor_lang['Use_Telegram'].' <i class="fa fa-paper-plane"></i>',
'control_type' => 'checkbox',
'attributes' => array(),
'on' => array(
'CustomSection:formElementsLoaded' => 'function(){$(this).trigger("change")}',
'change' => 'function(){
$c = $("[name = \'values[telegram_token]\']").closest(".editor-ctl-box");
if ( $(this).val() == "1" ) { $c.show(); } else { $c.hide(); };
$c = $("[name = \'values[telegram_chat_token]\']").closest(".editor-ctl-box");
if ( $(this).val() == "1" ) { $c.show(); } else { $c.hide(); };
.................
}',
),
),
// value 'telegram' --end
Well. I have found that $current_section['attributes']['id'] can be used instead to detect the GetSection() call. So this PR can be cancelled.
For section with
$section['always_process_values'] = true;
it is useful to distinguish which function includes section.php at the moment. With this PR, if$GettingSection
is set, it tells us that we are in GetSection() call (not in SectionTypes() or LoadSectionCssJs() ) and $sectionCurrentValues is really set with current section values.Yes, I know your position about my attempts to use CS in a situation where it is much easier to make a normal plugin. But CS is so good as a rapid development tools. And I generally succeed at doing whatever I want in my section. But sometimes I think that, if
$section['content']
was not an array but a function, it would be much easier to work with a config file, a Session and so on:)