Exemplo n.º 1
0
 /**
  * Handle the command.
  *
  * @param TypeRepositoryInterface $types
  * @param PageRepositoryInterface $pages
  */
 public function handle(TypeRepositoryInterface $types, PageRepositoryInterface $pages)
 {
     /* @var TypeInterface $type */
     $type = $types->find($this->type->getId());
     /* @var PageInterface $page */
     foreach ($type->getPages() as $page) {
         $pages->save($page->setAttribute('entry_type', $this->type->getEntryModelName()));
     }
 }
Exemplo n.º 2
0
 /**
  * Run the seeder.
  */
 public function run()
 {
     $this->pages->truncate();
     $type = $this->types->findBySlug('default');
     $welcome = (new PagesDefaultPagesEntryModel())->create(['content' => '<p>Welcome to PyroCMS!</p>']);
     $login = (new PagesDefaultPagesEntryModel())->create(['content' => '{{ form(\'login\').successMessage(\'You are now logged in.\')|raw }}']);
     $this->pages->create(['en' => ['title' => 'Welcome'], 'slug' => 'welcome', 'entry' => $welcome, 'type' => $type, 'enabled' => true, 'home' => true, 'theme_layout' => 'theme::layouts/default.twig'])->allowedRoles()->sync([]);
     $this->pages->create(['en' => ['title' => 'Login'], 'slug' => 'login', 'entry' => $login, 'type' => $type, 'enabled' => true, 'theme_layout' => 'theme::layouts/default.twig'])->allowedRoles()->sync([]);
 }
Exemplo n.º 3
0
 /**
  * Handle the command.
  *
  * @param StreamRepositoryInterface $streams
  * @param TypeRepositoryInterface   $types
  * @param Repository                $config
  */
 public function handle(StreamRepositoryInterface $streams, TypeRepositoryInterface $types, Repository $config)
 {
     /* @var TypeInterface $type */
     $type = $types->find($this->type->getId());
     /* @var StreamInterface $stream */
     $stream = $type->getEntryStream();
     $stream->fill([$config->get('app.fallback_locale') => ['name' => $this->type->getName(), 'description' => $this->type->getDescription()], 'slug' => $this->type->getSlug() . '_pages']);
     $streams->save($stream);
 }
Exemplo n.º 4
0
    /**
     * Run the seeder.
     */
    public function run()
    {
        if ($type = $this->types->findBySlug('default_pages')) {
            $this->types->delete($type);
        }
        /* @var TypeInterface $type */
        $type = $this->types->truncate()->create(['en' => ['name' => 'Default', 'description' => 'A simple page type.'], 'slug' => 'default', 'handler' => 'anomaly.extension.default_page_handler', 'theme_layout' => 'theme::layouts/default.twig', 'layout' => '<h1>{{ page.title }}</h1>

{{ page.content|raw }}']);
        $stream = $type->getEntryStream();
        $this->assignments->create(['stream' => $stream, 'field' => $this->fields->findBySlugAndNamespace('content', 'pages')]);
    }
 /**
  * Handle the command.
  *
  * @param TypeRepositoryInterface $types
  * @param PageFormBuilder         $builder
  * @param Request                 $request
  */
 public function handle(TypeRepositoryInterface $types, PageFormBuilder $builder, Request $request)
 {
     $this->builder->addForm('page', $builder->setType($types->find($request->get('type'))));
 }
 /**
  * Edit an existing assignment.
  *
  * @param AssignmentFormBuilder   $builder
  * @param TypeRepositoryInterface $types
  * @param                         $type
  * @param                         $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function edit(AssignmentFormBuilder $builder, TypeRepositoryInterface $types, $type, $id)
 {
     /* @var TypeInterface $type */
     $type = $types->find($type);
     return $builder->setStream($type->getEntryStream())->render($id);
 }
Exemplo n.º 7
0
 /**
  * Run the seeder.
  */
 public function run()
 {
     $this->pages->truncate();
     $type = $this->types->findBySlug('default');
     $this->pages->create(['en' => ['title' => 'Welcome'], 'slug' => 'welcome', 'entry' => $type->getEntryModel()->create(['content' => '<p>Welcome to PyroCMS!</p>']), 'type' => $type, 'enabled' => true, 'home' => true, 'theme_layout' => 'theme::layouts/default.twig'])->allowedRoles()->sync([]);
 }
Exemplo n.º 8
0
 /**
  * Return the modal for choosing a field to assign.
  *
  * @param FieldRepositoryInterface $fields
  * @return \Illuminate\View\View
  */
 public function chooseField(FieldRepositoryInterface $fields, TypeRepositoryInterface $types, $id)
 {
     $type = $types->find($id);
     return view('module::ajax/choose_field', ['fields' => $fields->findAllByNamespace('pages')->notAssignedTo($type->getEntryStream())->unlocked(), 'id' => $id]);
 }
 /**
  * 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()));
 }
Exemplo n.º 10
0
 /**
  * Return a form for an existing page type field and assignment.
  *
  * @param AssignmentFormBuilder       $form
  * @param StreamRepositoryInterface   $streams
  * @param TypeRepositoryInterface     $types
  * @param BreadcrumbCollection        $breadcrumbs
  * @param                             $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function assignment(AssignmentFormBuilder $form, StreamRepositoryInterface $streams, TypeRepositoryInterface $types, BreadcrumbCollection $breadcrumbs, $id, $assignment)
 {
     $type = $types->find($id);
     $breadcrumbs->put('module::breadcrumb.fields', 'admin/pages/types/fields/' . $type->getId());
     return $form->render($assignment);
 }