/** * Handle the command. * * @param EntryFormBuilder $builder */ public function handle(EntryFormBuilder $builder) { $type = $this->post->getType(); $builder->setModel($type->getEntryModelName()); $builder->setEntry($this->post->getEntryId()); $this->builder->addForm('entry', $builder); }
/** * Return the form for editing an existing post. * * @param PostRepositoryInterface $posts * @param PostEntryFormBuilder $form * @param $id * @return \Symfony\Component\HttpFoundation\Response */ public function edit(PostRepositoryInterface $posts, PostEntryFormBuilder $form, $id) { $post = $posts->find($id); $this->dispatch(new AddEntryFormFromPost($form, $post)); $this->dispatch(new AddPostFormFromPost($form, $post)); return $form->render($id); }
/** * Handle the form sections. * * @param PostEntryFormBuilder $builder */ public function handle(PostEntryFormBuilder $builder) { $builder->setSections(['general' => ['tabs' => ['general' => ['title' => 'module::tab.post', 'fields' => ['post_title', 'post_slug', 'post_excerpt', 'post_tags', 'post_enabled', 'post_publish_at', 'post_category', 'post_author']], 'content' => ['title' => 'module::tab.content', 'fields' => function (PostEntryFormBuilder $builder) { return array_map(function (FieldType $field) { return 'entry_' . $field->getField(); }, array_filter($builder->getFormFields()->base()->all(), function (FieldType $field) { return !$field->getEntry() instanceof PostModel; })); }], 'seo' => ['title' => 'module::tab.seo', 'fields' => ['post_meta_title', 'post_meta_keywords', 'post_meta_description']], 'css' => ['title' => 'module::tab.css', 'fields' => ['post_css']], 'js' => ['title' => 'module::tab.js', 'fields' => ['post_js']]]]]); }
/** * Handle the form sections. * * @param PostEntryFormBuilder $builder */ public function handle(PostEntryFormBuilder $builder) { $builder->setSections(['general' => ['fields' => ['post_title', 'post_slug', 'post_summary']], 'fields' => ['fields' => function (PostEntryFormBuilder $builder) { return array_map(function (FieldType $field) { return 'entry_' . $field->getField(); }, array_filter($builder->getFormFields()->base()->all(), function (FieldType $field) { return !$field->getEntry() instanceof PostModel; })); }], 'organization' => ['fields' => ['post_category', 'post_tags']], 'seo' => ['fields' => ['post_meta_title', 'post_meta_keywords', 'post_meta_description']], 'options' => ['fields' => ['post_author', 'post_enabled', 'post_featured', 'post_publish_at']]]); }
/** * Handle the command. * * @param TypeRepositoryInterface $types * @param PostFormBuilder $builder * @param Request $request */ public function handle(TypeRepositoryInterface $types, PostFormBuilder $builder, Request $request) { $this->builder->addForm('post', $builder->setType($types->find($request->get('type')))); }
/** * Handle the command. * * @param TypeRepositoryInterface $types * @param EntryFormBuilder $builder * @param Request $request */ public function handle(TypeRepositoryInterface $types, EntryFormBuilder $builder, Request $request) { $type = $types->find($request->get('type')); $this->builder->addForm('entry', $builder->setModel($type->getEntryModelName())); }
/** * Handle the command. * * @param PostFormBuilder $builder */ public function handle(PostFormBuilder $builder) { $builder->setEntry($this->post->getId()); $this->builder->addForm('post', $builder); }