/** * 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 status key. * * @return null|string */ public function status() { if (!$this->object->isEnabled()) { return 'draft'; } if ($this->object->isEnabled() && !$this->object->isLive()) { return 'scheduled'; } if ($this->object->isEnabled() && $this->object->isLive()) { return 'live'; } return null; }