Skip to content

Instantly share code, notes, and snippets.

@stevep
Last active July 29, 2016 19:45
Show Gist options
  • Save stevep/f3d2aa263a189a5b2560c138f63b9ef0 to your computer and use it in GitHub Desktop.
Save stevep/f3d2aa263a189a5b2560c138f63b9ef0 to your computer and use it in GitHub Desktop.
<?php
namespace StoutLogic\YoungDental\Fields;
class BrandSlide extends \Understory\ACF\FieldGroup
{
protected function configure($builder)
{
return $builder
->addText('title')
->addWysiwyg('quote')
->addText('citation');
}
public function getQuote()
{
return apply_filters('the_content', $this->getMetaValue('quote'));
}
}
<?php
namespace StoutLogic\YoungDental\Fields;
class BrandSlider extends \Understory\ACF\FieldGroup
{
protected function configure($builder)
{
return $builder
->addRepeater('slides', ['layout' => 'block'])
->addFields(new BrandSlide);
}
public function getSlides()
{
return $this->getMetaValues('slides', BrandSlide::class);
}
}
<?php
/**
* Template Name: Home
*/
namespace StoutLogic\YoungDental\Views;
use StoutLogic\YoungDental\Fields;
class HomeTemplate extends \Understory\View
{
protected function configure()
{
$this->set('brandSlider', new Fields\BrandSlider);
}
}
{% extends "base.twig" %}
{%- block content -%}
{% for slide in brandSlider.slides %}
<h2>{{ slide.title }}</h2>
<blockquote>
{{ slide.quote }}
<cite>{{ slide.citation }}</cite>
</blockquote>
{% endfor %}
{%- endblock -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment