<?php namespace Eae\Composers\QuestionFour;

use QuestionFourTemplateConfiguration;
use Input;
use Config;

class QuestionFourComposer 
{
    use \Eae\Composers\Traits\SocialTrait;

    public function compose($view) {
      $bodyClass = 'question-four';

      $data = $view->getData();
      $page = $data['object'];

      $articles = $page->articles()->full()->orderBy('position')->get();
      $videos = $page->videos()->full()->orderBy('position')->get();
      $qaBlocks = $page->questionAnswerBlocks()->full()->with('questionsAnswers')->get();

      $templateData = QuestionFourTemplateConfiguration::full()
          ->where('entry_id', $page->id)->first();
      $shareData = $this->_getShareData($page, $templateData, $articles);
      $view->with(compact('bodyClass', 'templateData', 'articles', 'qaBlocks', 'videos', 'shareData'));
    }
}
