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

Dateiauswahl und rgxp funktioniert nicht bei columnsCallback #98

Closed
Total-Reality opened this issue Jan 16, 2021 · 7 comments
Closed

Dateiauswahl und rgxp funktioniert nicht bei columnsCallback #98

Total-Reality opened this issue Jan 16, 2021 · 7 comments
Assignees
Labels
bug Something isn't working ready for testing Ready for testing. Wait for response.
Milestone

Comments

@Total-Reality
Copy link

Die Dateiauswahl funktioniert tadellos, wenn man mit columnFields arbeitet und die Felder direkt in den DCA-Code schreibt.
Wenn man allerdings mit dem columnsCallback arbeitet, um mehr Übersicht zu erhalten und ggf. etwas mehrfach zu nutzen, dann gibt es einige Probleme.

Folgendes ist mir bisher aufgefallen im Hinblick auf "columnsCallback":

  • rgxp => digit funktioniert nicht, es werden dann trotzdem sämtliche Angaben akzeptiert. Vermutlich greifen auch die anderen rgxp Angaben nicht (das ist allerdings ungetestet)
  • Die Dateiauswahl funktioniert gar nicht, ein Bild kann ausgewählt werden, aber nach dem Schließen des Dialogs wird das Bild leider nicht angezeigt (und nach dem Speichern erst recht nicht)

Könnt ihr das bitte irgendwie beheben oder wird der Callback nicht mehr unterstützt?

Mein Code:

$GLOBALS['TL_DCA'][$strTblName]['fields']['mcwtest'] =
[
    'exclude'   => true,
    'inputType' => 'multiColumnWizard',
    'eval'      => [
        'minCount'     => 2,
        'maxCount'     => 4,
        'columnsCallback' => array('tl_mcw_test', 'getExtraFields'),
    ],
    'sql'       => "blob NULL"
];


class tl_mcw_test extends Backend
{
  public function getExtraFields()
  {

    $arrFields = array
    (
      'min' => array
      (
        'label'              => 'Min',
        'inputType'          => 'text',
        'eval'               => array('rgxp'=>'digit', 'maxlength'=>5, 'style'=>'width:50px')
      ),
      'a_media' => array
      (
        'label'              => 'File',
        'inputType'          => 'fileTree',
        'eval'               => array('fieldType' => 'radio', 'files' => true, 'filesOnly' => true, 'multiple' => false, 'style'=>'width:150px')
      )
    );

    return $arrFields;
  }
}

Altes Ticket Siehe hier: menatwork/MultiColumnWizard#205 (comment)

@zonky2 zonky2 added the bug Something isn't working label Jan 16, 2021
@zonky2 zonky2 added this to the 3.4.10 milestone Jan 16, 2021
@zonky2
Copy link
Contributor

zonky2 commented Jan 16, 2021

Ich habe mir das gestern noch mit @stefanheimes angesehen...

Problem ist, dass der Block https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/master/src/Contao/Widgets/MultiColumnWizard.php#L663-L666 "zu spät" kommt und sowohl die Methode validate als auch generateLabel vor der Methode generate gezündet werden... sollte also eher in den Constructor - damit geht das validate wieder... für den FilePicker muss aber noch am AjaxCall geschraubt werden (siehe Fehlermeldung im Debug-Mode im response mit den Entwicklerwerkzeugen des Browsers)

@Total-Reality
Copy link
Author

Danke für die schnelle Antwort.
Ist ja cool... habs grad getestet und es geht. Juhu :) 👍

Habe die von dir markierte Stelle in Zeile 174 bis 177 eingefügt und aus Zeile 663 bis 666 entfernt. (Kein Wunder dass es nicht ging, in Zeile 666 sollte man nie etwas schreiben 🔥 😸 )

Damit klappt es nun sowohl bei den columnFields als auch bei columnsCallback.

Wie du schon vermutet hast, geht die Dateiauswahl dann allerdings noch nicht.

@zonky2
Copy link
Contributor

zonky2 commented Jan 16, 2021

Wie du schon vermutet hast, geht die Dateiauswahl dann allerdings noch nicht.

... ich vermute nicht - ich teste 😏 🤘

@Total-Reality
Copy link
Author

Wenn ich wüsste man nen Pull Request schreibt, dann könnte das Ticket bald erledigt sein?
Oder wie ist das zu verstehen "Successfully merging a pull request may close this issue."?

@zonky2
Copy link
Contributor

zonky2 commented Jan 25, 2021

  • github Account: hast du ja...
  • oben rechts auf Fork
  • installier Dir Sourcetree o.ä.
  • pull Projekt von Deinem Fork lokal
  • Branch erstellen z.B. "hotfix/add_rgxp_in_columnscallback"
  • Dateien ändern
  • Commit erstellen
  • den Commit Push(en)
  • hier auf Github gehen - dann wird dir angeboten einen PR zu erstellen

stefanheimes added a commit that referenced this issue Feb 14, 2021
This should fix a problem where the execution of the column callback was to late and some function hasn't the proper information of the columns.
@stefanheimes
Copy link
Member

Fixed in 3.4.10 please test again

@stefanheimes stefanheimes added the ready for testing Ready for testing. Wait for response. label Feb 14, 2021
@zonky2 zonky2 modified the milestones: 3.4.10, 3.4.11 Feb 24, 2021
@Total-Reality
Copy link
Author

Fixed in 3.4.10 please test again

Top Arbeit! Vielen Dank, funktioniert super. Damit ist das Ticket erledigt aus meiner Sicht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for testing Ready for testing. Wait for response.
Projects
None yet
Development

No branches or pull requests

3 participants