';
echo __('Tokens inside the Text Editor or Heading widgets do not get evaluated. Please use the widget Text Editor with Tokens instead.', 'dynamic-content-for-elementor');
echo '
';
if (!\class_exists('\\Timber\\Timber')) {
$text = __('Notice: The free WordPress Plugin Timber is required for HTML Template to work.', 'dynamic-content-for-elementor');
$text = \sprintf($text, 'https://wordpress.org/plugins/timber-library/');
echo '
' . $text . '
';
}
echo '';
echo '
';
$this->enqueue_code_editor_scripts(self::FIELD_CODE);
}
public function render_preview_metabox($post)
{
$btn_url = admin_url('admin-ajax.php');
$attr = ['data-action' => 'dce_preview_pdf_html_template', 'data-url' => $btn_url, 'id' => 'dce-preview-pdf', 'type' => 'button', 'class' => 'dce-pdf-preview-button'];
echo '';
echo '';
}
// This function will only present the font options to the user.
public function render_fonts_metabox($post)
{
echo '
' . __('The following fonts can be used with the font-family CSS property. ', 'dynamic-content-for-elementor') . '
' . __('RTL languages: please notice that you cannot use the core fonts in a page that contains also an RTL language, like Arabic or Hebrew. Upload them as Custom Fonts if you need them.', 'dynamic-content-for-elementor') . '
';
$text = __('Custom Fonts can be added in the Elementor Custom Fonts menu page. Only the TTF type is supported. Weight can only be normal or bold, style can only be normal or italic. The following are the ones that were detected:', 'dynamic-content-for-elementor');
$text = \sprintf($text, admin_url('edit.php?post_type=elementor_font'));
echo '
';
}
public function render_images_metabox($post)
{
$media_url = get_admin_url() . '/upload.php';
echo '
' . __('To insert an image, first go to the ', 'dynamic-content-for-elementor');
echo "" . __('WordPress Media Library', 'dynamic-content-for-elementor') . '';
echo __(', select an image and find its ID. Then you can use the image like this:', 'dynamic-content-for-elementor') . '
' . __('Notice how we used .file_loc , which is a file system path, instead of a URL. Avoid image URLs as they will be slow to fetch.', 'dynamic-content-for-elementor') . '
';
echo '
' . __('To insert a signature you can use:', 'dynamic-content-for-elementor') . '
';
echo '<img src="{{ form_raw.signature_field_id }}">';
}
// Render a select2 input where $id is its id, and $post_id is the
// preselected post id.
public function render_select2($id, $post_id, $label)
{
// do not forget about WP Nonces for security purposes
$attr = ['name' => $id, 'id' => $id, 'style' => 'width:99%;max-width:25em;'];
if ($post_id) {
$title = wp_kses_post(get_the_title($post_id));
$title = \mb_strlen($title) > 50 ? \mb_substr($title, 0, 49) . '...' : $title;
}
echo '
';
echo '
';
}
public function render_preview_data_metabox($post)
{
wp_enqueue_script('dce-pdf-html-template', DCE_URL . 'assets/js/pdf-html-templates.js', [], DCE_VERSION, \true);
$data = get_post_meta($post->ID, self::TEMPLATE_META_KEY, \true);
$post_id = $data[self::FIELD_PREVIEW_POST] ?? \false;
$label = __('Select a Post to get things like Post Title, ACF fields etc. for the preview (can leave empty if these are not used)', 'dynamic-content-for-elementor');
$this->render_select2(self::FIELD_PREVIEW_POST, $post_id, $label);
$attr = ['name' => self::FIELD_PREVIEW_FORM_DATA, 'id' => self::FIELD_PREVIEW_FORM_DATA, 'style' => 'width: 100%; height: 10em;'];
$form_data = $data[self::FIELD_PREVIEW_FORM_DATA] ?? self::DEFAULT_PREVIEW_DATA;
echo '