Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Page create does not respect default article settings #8720

Open
Aybee opened this issue May 31, 2017 · 11 comments
Open

Page create does not respect default article settings #8720

Aybee opened this issue May 31, 2017 · 11 comments
Labels

Comments

@Aybee
Copy link
Contributor

Aybee commented May 31, 2017

Config your default article settings.

$GLOBALS['TL_DCA']['tl_article']['fields']['printable']['default'] = array('print', 'pdf');

Create a page. The article created with this page does not have the default article settings.

@leofeyer
Copy link
Member

Have you tried it with serialize(array('print', 'pdf'))?

@Toflar
Copy link
Member

Toflar commented May 31, 2017

I guess what he means is that tl_page::generateArticle() does not load the tl_article DCA and check for any defaults...

@Aybee
Copy link
Contributor Author

Aybee commented May 31, 2017

Default settings works but not when article gets created while a new page gets created. Only works when you create a new article.

Now I've tested your proposal but with no success as expected.

@leofeyer leofeyer added the defect label Jun 5, 2017
@leofeyer leofeyer added this to the 3.5.28 milestone Jun 5, 2017
@leofeyer
Copy link
Member

leofeyer commented Jul 7, 2017

@contao/developers How can we solve this without duplicating most of the DC_Table::create() code?

@Toflar
Copy link
Member

Toflar commented Jul 7, 2017

I would just solve this very specific case...

So here I would use this piece of code.

@leofeyer
Copy link
Member

What if the encrypt flag is set?

@Toflar
Copy link
Member

Toflar commented Jul 11, 2017

@leofeyer
Copy link
Member

@contao/developers Do you agree with @Toflar's suggestion?

@leofeyer leofeyer modified the milestone: 3.5.28 Jul 11, 2017
@aschempp
Copy link
Member

I can't think of a better solution…

@leofeyer leofeyer added this to the 3.5.29 milestone Jul 12, 2017
@leofeyer
Copy link
Member

Although IMO we have to copy a lot more code, don't we?

https://github.com/contao/core/blob/master/system/modules/core/drivers/DC_Table.php#L874-L910

@leofeyer leofeyer removed this from the 3.5.29 milestone Aug 16, 2017
@Toflar
Copy link
Member

Toflar commented Nov 2, 2017

You are right. What about extracting that code into its own method (e.g. public function copyField()) and then reuse it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants