Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Driver with DC_Table + CS #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rabauss
Copy link
Contributor

@rabauss rabauss commented Dec 13, 2022

I've compared and "synced" the core DC_Table to the Driver, so that we can better see the changes in the future.
The Contao Classes are now used with the Contao namespace.
Some deprecations were replaced and some CS was applied.
Even some PHP 8 warnings could be solved.

In the edit method I was not sure about the following points.
So I left them as they were in the Driver:

  • ajax section with VERSION_NUMBER + subpal
  • Autofocus the first field
  • Input::get('nc')
  • Input::get('popup')
  • split-button
  • $strVersionField
  • Always create a new version if something has changed
  • $strBackUrl
  • Set the focus if there is an error
  • <script>
  • Show a warning if the record has been saved by another user
  • saveNduplicate
  • constants for modes

@aschempp
Copy link
Member

Thanks for the tedious work! I intentionally keep the "legacy" code style in my DCs (this one and in Isotope) to make it easier to compare it to Contaos DC_Table. If we now use new code style that would be very hard, wouldn't it?

@rabauss
Copy link
Contributor Author

rabauss commented Jan 19, 2023

Yes, you're right I reverted my CS commit and fixed the indentations manually - because the core uses tabs!
I tried to "resync" again and probably fixed some points of the list above.
Although there are still some changes which I don't really know how to sync or specially the constants for modes cannot be synced as long as this extension supports contao 4.4!

By the way I'm not sure if all changes are really compatible with 4.4!

@aschempp
Copy link
Member

I have removed usage of the global Contao classes in 3dd8dd6, unfortunately that means this PR needs to be rebased 😕

@rabauss
Copy link
Contributor Author

rabauss commented Mar 17, 2023

I've rebased 🚀
But we still need to discuss the points from my opening comment.

By the way I compared with DC_Table of contao 4.13 - https://github.com/contao/contao/blob/4.13/core-bundle/src/Resources/contao/drivers/DC_Table.php

@@ -354,7 +366,7 @@ public function edit($intId=null, $ajaxId=null)
$this->objActiveRecord->{$this->strField} = $this->varValue;

// Build the row and pass the current palette string (thanks to Tristan Lins)
$blnAjax ? $strAjax .= $this->row($this->strPalette) : $return .= $this->row($this->strPalette);
$blnAjax ? $arrAjax[$thisId] .= $this->row($this->strPalette) : $return .= $this->row($this->strPalette);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We often got the following warning in the logs in one of our projects: Warning: Only the first byte will be assigned to the string offset
It's probably because of the uninitialized index $thisId, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

2 participants