/** * Processes the value of this field before getting set to the model in the populate() method * @see \CMF\Model\Base::populate() * @param mixed $value The value about to be set * @param array $settings The settings for this field * @param object $model The model * @return mixed The value ready for setting on the model */ public static function process($value, $settings, $model) { if (!(isset($settings['auto_update']) && !$settings['auto_update']) && (isset($settings['template']) && !empty($settings['template']))) { $post_data = $context = \Input::post(); if (!is_array($context)) { $context = array(); } $context['model'] = $model; if (class_exists('Model_Settings')) { $context['settings'] = \Model_Settings::instance(); } $twig = \View_Twig::parser(); $loader = \View_Twig::loader(); if (!isset($loader) || is_null($loader)) { $loader = new Twig_Loader_String(); $twig->setLoader($loader); \View_Twig::setLoader($loader); } return $twig->render($settings['template'], $context); } return $value; }