If i have e.g. only a "Subtitle" with a poition top or bottom then an empty Custom tab will be shown on edit- or new content page.


Based on the source code of the edit-content or new-content files, the tab button appears if the custom field in the settings page is not empty.
There is no condition that if this field is displayed in one of the positions, the tab button should not appear.
~
customFields())): ?>
~
version 3.x
PHP 7.4.5 (on localhost)
If i have e.g. only a "Subtitle" with a poition top or bottom then an empty Custom tab will be shown on edit- or new content page.
I do not understand what the problem is. It's a custom or additional field, that can be used in the example for a subtitle. You can modify the theme to show it.
I guess he only means, that the "Custom" Tab within the Content Sidebar is shown even if it doesn't contain any custom field at all.
As shown in the example: If you set all of your custom fields to the top or bottom position the Sidebar View is also available, but empty, since it only contains custom fields with no position value set at all.
There was a misunderstanding. I thought with tab the field was ment. Thank you!
I think this tab is not intended (there is a JavaScript error).
I think this tab is not intended (there is a JavaScript error).
No, I checked the source. As mentioned by @JTWebTools the custom fields-area on the sidebar is shown if any "customFields" are available or not without checking the position values of them. There is no additional JavaScript which toggles them.
I guess a good way to filter them is by just offering an additional parameter on the $site->customFields() function and passing them on the respective new-content.php and edit-content.php files, such as
<?php
public function customFields($position = null)
{
$customFields = Sanitize::htmlDecode($this->getField('customFields'));
$customFields = json_decode($customFields, true);
if(!empty($customFields) && !empty($position)) {
$customFields = array_filter($customFields, function($item) use ($position) {
if($position === "sidebar") {
return !isset($item["position"]);
}
return $position === $item["position"];
});
}
return $customFields;
}
I guess he only means, that the "Custom" Tab within the Content Sidebar is shown even if it doesn't contain any custom field at all.
As shown in the example: If you set all of your custom fields to the
toporbottomposition the Sidebar View is also available, but empty, since it only contains custom fields with nopositionvalue set at all.
Yes, exactly!
I guess a good way to filter them is by just offering an additional parameter on the $site->customFields() function and passing them on the respective new-content.php and edit-content.php files, such as
Thank you, that looks great!
@clickwork-git please add that to the next release!
There is no additional JavaScript which toggles them.
I have a JavaScript error on the page, but, yes, it's not related to the tab (I presumed it would write the content of the tab). It's not my day...
@clickwork-git please add that to the next release!
@dignajar is the programer. ;-)