';
}
}
echo $out;
}
/**
* Get common terms for taxonomy
* @param string $taxonomy
* @return array
*/
protected function getCommonTerms(string $taxonomy):array {
$manager = new UserTermsManager();
return $manager->getUserTerms($this->user_id, $taxonomy);
}
protected function renderDateFilters():void
{
$postType = jvbCheckBase($this->content);
// Get available months
global $wpdb;
$months = $wpdb->get_results("
SELECT DISTINCT
YEAR(post_date) as year,
MONTH(post_date) as month
FROM $wpdb->posts
WHERE post_type = '{$postType}'
AND post_author = '{$this->user_id}'
ORDER BY post_date DESC
");
// Quick filters
$out = '
';
$form = '
';
// Custom date range
$out .= jvbNewModal(
'date-range',
'Filter Results by Date:',
$form
);
echo $out;
}
protected function renderBulkControls():void
{
if (empty($this->bulkActions)) {
return;
}
?>
renderCreateModal();
$this->renderEditModal();
$this->renderBulkEditModal();
}
protected function renderCreateModal():void
{
echo jvbNewModal(
'create',
'Creating New '.$this->config['singular'],
str_replace('edit-form"', 'create-form" data-noautosave', $this->editForm())
);
}
protected function editForm():string
{
ob_start();
?>
Before (Starting Point)
renderRowFields(); ?>
fields;
// Render priority fields first
$first = ['post_thumbnail', 'post_title', 'price'];
foreach ($first as $f) {
if (array_key_exists($f, $fields)) {
$this->meta->render('form', $f, $fields[$f]);
unset($fields[$f]);
}
}
// Render remaining fields
foreach ($fields as $name => $config) {
if (!array_key_exists('hidden', $config) || !$config['hidden']) {
$this->meta->render('form', $name, $config);
}
}
}
protected function getApplicableStatuses(string $prefix) {
foreach ($this->statuses as $status => $config) {
if ($status === 'all') {
continue;
}
if (in_array($status, ['future', 'past'])) {
if ($status === 'future') {
$status = 'publish';
$config = [
'icon' => 'publish',
'label' => 'Live',
];
} else {
continue;
}
}
$disabled = ($status === 'publish' && !$this->userCanPublish) ? ' disabled' : '';
?>
>
singular,
$this->editForm()
);
}
protected function renderBulkEditModal():void
{
if (empty($this->bulkActions)) return;
ob_start();
?>
'.$this->config['plural'],
$form
);
}
protected function renderTemplates():void
{
$this->renderListView();
$this->renderGridView();
$this->renderTableView();
$this->renderTableRow();
if (Features::forContent($this->content)->has('is_timeline')) {
$temp = array_filter($this->fields, function ($field) {
if (array_key_exists('for_all', $field) && $field['for_all'] === true) {
return true;
}
return false;
});
$form = new MetaForm();
echo '';
$form->renderImagePreview(null,$temp);
echo '';
}
echo jvbGetEmptyStateTemplate();
echo jvbGetGalleryPreviewTemplate();
}
protected function renderItemSelect():string
{
ob_start();
?>
singular ?>
fields as $name => $config) {
$renderMode = $form ? 'form' : 'render';
$field = $this->meta->render($renderMode, $name, $config, false, true);
// Special handling for title in grid view
if ($name === 'post_title' && !$form) {
$field = str_replace('