| | |
| | | /** |
| | | * Render complete form from Meta instance |
| | | */ |
| | | public static function renderFormFrom(Meta $meta, string $endpoint, array $options = []): string |
| | | public static function renderFormFrom(Meta $meta, string $endpoint, array $options = [], array $fields = []): string |
| | | { |
| | | $id = $options['form-id'] ?? $endpoint; |
| | | $classes = isset($options['classes']) ? ' class="' . implode(' ', $options['classes']) . '"' : ''; |
| | |
| | | $output .= '<p>' . esc_html($d) . '</p>'; |
| | | } |
| | | } |
| | | |
| | | foreach ($meta->configs() as $name => $config) { |
| | | $output .= static::render($name, $meta->get($name), $config); |
| | | $allFields = $meta->getAll($fields); |
| | | foreach ($allFields as $name => $value) { |
| | | $config = $meta->config($name); |
| | | $output .= static::render($name, $value, $config); |
| | | } |
| | | |
| | | if (!empty($options['submit'])) { |
| | |
| | | { |
| | | return sprintf('<dialog id="jvb-selector" aria-labelledby="modal-title" aria-modal="true"> |
| | | <div class="wrap col"> |
| | | <header class="modal-header"> |
| | | <header class="row"> |
| | | <h3 id="modal-title">Select Taxonomy</h3> |
| | | </header> |
| | | |
| | |
| | | <template class="selectedTerm"> |
| | | <div class="selected-item row"> |
| | | <span class="item-name"></span> |
| | | <button type="button" class="remove-term row">%s</button> |
| | | <button type="button" class="remove-term">%s</button> |
| | | </div> |
| | | </template> |
| | | <template class="termBreadcrumb"> |
| | | <button type="button" class="path-level"></button> |
| | | </template>', |
| | | static::search('Search terms', 'search-terms'), |
| | | str_replace('class="search-container', 'class="open search-container', static::search('Search terms', 'search-terms')), |
| | | jvbModalActions(), |
| | | jvbIcon('plus-square'), |
| | | jvbIcon('x') |