本文整理汇总了PHP中Timber::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Timber::render方法的具体用法?PHP Timber::render怎么用?PHP Timber::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timber
的用法示例。
在下文中一共展示了Timber::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: button
/**
* button
*
* Displays the addthis sharing button setup on their dashboard page
*/
public static function button()
{
if ($addthis_id = get_theme_mod('addthis-id')) {
wp_enqueue_script('addthis');
\Timber::render('addthis.twig');
}
}
示例2: render_product_popup
function render_product_popup()
{
$intPostId = intval($_POST['post_id']);
$objPost = new TimberPost($intPostId);
Timber::render('partials/product-popup.twig', array('post' => $objPost));
wp_die();
}
示例3: render
/**
* Renders the given template with a context using timber
*
* @param $template
* @param $context
* @throws \RuntimeException
* @author Tim Perry
*/
protected function render($template, $context)
{
if (!class_exists('Timber')) {
throw new \RuntimeException("Timber is not installed");
}
\Timber::render($template, $context);
}
示例4: form
public function form($instance)
{
$context = \Timber::get_context();
$context['title'] = !empty($instance['title']) ? $instance['title'] : __('Test', self::I18N_DOMAIN);
$context['widget'] = $this;
\Timber::render('timber-test-widget-form.twig', $context);
}
示例5: render
/**
* render
*
* Render cookie-consent.twig
*
*/
public function render()
{
if (!isset($_COOKIE['cookie-consent'])) {
do_action('show_cookie_consent');
\Timber::render('cookie-consent.twig', array('implied_consent_text' => get_theme_mod('implied-consent-text', $this->implied_consent_text), 'button_text' => get_theme_mod('button-text', $this->button_text), 'privacy_url' => get_theme_mod('privacy-url', $this->privacy_url), 'privacy_link_text' => get_theme_mod('privacy-link-text', $this->privacy_link_text)));
}
}
示例6: load_view
public function load_view()
{
$context = Timber::get_context();
$context['data'] = $this->data;
$context['constants'] = get_slate_constants();
Timber::render(theme_views . '/single.twig', $context);
}
示例7: getCallback
/**
*
* {$inheritdoc}
*
*/
public function getCallback()
{
$context = \Timber::get_context();
$context['options'] = $this->getOptions();
$context['field_name'] = self::META_NAME_PAGE_TYPE;
$context['current_value'] = $this->getCurrentValue();
\Timber::render($this->dic['CMS']->getViewPath('meta_boxes/page-type.html.twig'), $context);
}
示例8: render
/**
* render
*
* Render the twig $template
*
*/
public function render()
{
$this->context = $this->get_context();
$class = new \ReflectionClass(get_called_class());
$class = Helper::camel_to_underscored($class->getShortName());
$this->context = apply_filters("{$class}_context", $this->context);
do_action("render_{$class}");
\Timber::render($this->template, $this->context);
}
示例9: script
/**
* script
*
* @return void
*/
public function script()
{
$track_logged_in = get_theme_mod('track-logged-in');
if ($track_logged_in || !$track_logged_in && !is_user_logged_in()) {
if ($google_analytics_id = urlencode(get_theme_mod('google-analytics-id'))) {
\Timber::render('google-analytics.twig', array('google_analytics_id' => $google_analytics_id));
}
}
}
示例10: twig_replacements
/**
* Get the twig file and pass the replacement to it.
* This function is just a helper for the do_twig_replacements function.
*/
public function twig_replacements($replacement = false)
{
// If no replacement has been defined, exit.
if (!$replacement) {
return;
}
$context = Timber::get_context();
$context['element'] = $replacement;
Timber::render(array('twig-str_replace.twig'), $context, Maera()->cache->cache_duration());
}
示例11: render
/**
* Render a template
* This will render the necessary twig template
*/
public function render($templates = null, $context = null)
{
if (is_null($templates)) {
$templates = apply_filters('maera/templates', array());
}
if (is_null($context)) {
$context = $this->context();
}
Timber::render($templates, $context, Maera()->cache->cache_duration(), Maera()->cache->cache_mode());
}
示例12: menuPageCallback
/**
*
* Callback methods for the options page
*
* @author Tim Perry
*
*/
public function menuPageCallback()
{
$args = array('public' => true);
$context = \Timber::get_context();
$context['postTypes'] = get_post_types($args, 'names');
$context['settingsGroupName'] = self::SETTINGS_GROUP_NAME;
$context['fieldName'] = self::OPTION_NAME_SHOW_ON;
$context['currentValue'] = get_option(self::OPTION_NAME_SHOW_ON);
\Timber::render($this->getPath() . '/views/options-page.twig', $context);
}
示例13: get_short_code
function get_short_code($atts)
{
return getOutput(function () {
$context = $this->get_timber_context();
foreach ($this->timber_attributes as $key => $value) {
$context[$key] = $value;
}
Timber::render('template.twig', $context);
});
}
示例14: render_comment
/**
* Render Comment
*
* @param object $comment
* @param array $args
* @param integer $depth
*/
function render_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
$args['depth'] = $depth;
$args['comment'] = new TimberComment($comment);
$args['date_format'] = get_option('date_format');
$args['time_format'] = get_option('time_format');
$args['args'] = $args;
Timber::render('includes/comment.html.twig', $args);
}
示例15: form
/**
* form
*
* @param array $instance
* @return void
*/
public function form($instance)
{
$defaults = array('user' => __("User", THEMENAME), 'title' => __("Pinterest", THEMENAME), 'type' => 'board', 'image-width' => 80, 'board-height' => 320, 'board-width' => 400);
$instance = wp_parse_args((array) $instance, $defaults);
\Timber::render('admin.text.twig', array('label' => __("Title", THEMENAME), 'id' => $this->get_field_id('title'), 'name' => $this->get_field_name('title'), 'value' => esc_attr($instance['title']), 'class' => 'widefat'));
\Timber::render('admin.text.twig', array('label' => __("User", THEMENAME), 'id' => $this->get_field_id('user'), 'name' => $this->get_field_name('user'), 'value' => esc_attr($instance['user']), 'class' => 'widefat'));
\Timber::render('admin.select.twig', array('label' => __("Type", THEMENAME), 'id' => $this->get_field_id('type'), 'name' => $this->get_field_name('typw'), 'options' => array('board' => "Board", 'profile' => "Profile"), 'value' => 'board', 'class' => 'widefat'));
\Timber::render('admin.number.twig', array('label' => __("Image width", THEMENAME), 'id' => $this->get_field_id('image-width'), 'name' => $this->get_field_name('image-width'), 'value' => esc_attr($instance['image-width'])));
\Timber::render('admin.number.twig', array('label' => __("Image width", THEMENAME), 'id' => $this->get_field_id('image-width'), 'name' => $this->get_field_name('board-height'), 'value' => esc_attr($instance['board-height'])));
\Timber::render('admin.number.twig', array('label' => __("Image width", THEMENAME), 'id' => $this->get_field_id('image-width'), 'name' => $this->get_field_name('board-width'), 'value' => esc_attr($instance['board-width'])));
}