Example #1
0
 /**
  * Handle the command.
  *
  * @param Repository $config
  * @param Resolver   $resolver
  * @param Evaluator  $evaluator
  * @param Value      $value
  * @return string
  */
 public function handle(Repository $config, Resolver $resolver, Evaluator $evaluator, Value $value)
 {
     $base = '/' . $config->get('anomaly.module.posts::paths.module');
     if (!$this->post->isLive()) {
         return $base . '/preview/' . $this->post->getStrId();
     }
     return $base . '/' . $value->make($evaluator->evaluate($resolver->resolve($config->get('anomaly.module.posts::paths.permalink'), ['post' => $this->post]), ['post' => $this->post]), $this->post);
 }
 /**
  * Return the column value.
  *
  * @param Table $table
  * @param array $column
  * @param       $entry
  * @return View|mixed|null
  */
 public function make(Table $table, $column, $entry)
 {
     if (is_array($column['value'])) {
         foreach ($column['value'] as &$value) {
             $value = $this->value->make($value, $entry, 'entry', compact('table'));
         }
     }
     return $this->value->make($column, $entry, 'entry', compact('table'));
 }
 /**
  * Replace the entry values
  * in the button property.
  *
  * @param  array $button
  * @param        $entry
  * @return array
  */
 public function replace(array $button, $entry)
 {
     $enabled = array_get($button, 'enabled');
     if (is_string($enabled)) {
         $enabled = filter_var($this->value->make($enabled, $entry), FILTER_VALIDATE_BOOLEAN);
         $button['enabled'] = $enabled;
     }
     return $button;
 }
Example #4
0
 /**
  * Append extra data.
  *
  * @param EntryInterface $entry
  * @param                $config
  */
 protected function appendExtra(EntryInterface $entry, &$config)
 {
     foreach ($config['fields'] as $field => $value) {
         $config['extra'][$field] = $value;
     }
     foreach (array_get($config, 'extra', []) as $key => $value) {
         if (!isset($config['extra'][$key])) {
             $config['extra'][$key] = $this->value->make($value, $entry);
         }
     }
 }
 /**
  * Return the segment value.
  *
  * @param Tree  $tree
  * @param array $segment
  * @param       $entry
  * @return View|mixed|null
  */
 public function make(Tree $tree, array $segment, $entry)
 {
     return $this->value->make($segment, $entry, 'entry', compact('tree'));
 }