Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Event für individuelles Visforms Plugin

More
2 years 1 month ago - 2 years 1 month ago #7929 by MaliRaj
Hallo Visforms-Team,
für die Weiterentwicklung eines individuellen J4 Visforms Plugins bin ich auf der Suche nach einer Möglichkeit, mit dem ich in Datenansichten (Backend und Frontend) auf den Buttonclick "Eintrag verstecken/Eintrag veröffentlichen" reagieren kann. Ich möchte daraufhin einen Wert in in einigen Tabellen anpassen. Daher meine Frage:
Gibt es bereits ein Visforms-Event ala 'onVisformsdataUnpublish' oder 'onVisformsdataPublish', das ich dafür nutzen könnte?
Wie könnte ich das alternativ lösen? Über das JoomlaEvent 'onTableAfterPublish' und 'onTableBeforePublish' konnte ich (bisher) keine Infos finden.

Freundliche Grüße aus PM
Heinz
Last edit: 2 years 1 month ago by MaliRaj.

More
2 years 1 month ago #7937 by Administrator IV
Replied by Administrator IV on topic Event für individuelles Visforms Plugin
Hallo Heinz,

verwende das Visforms Event 'onVisformsdataJFormChangeState'.
Es wird für beide Datenansichten (Backend und Frontend) gefeuert.

public function onVisformsdataJFormChangeState($context, $pks, $value) {
    if ($context === 'com_visforms.visdata') {
        // $pks is an array of all affected recordset IDs
        // value of 0 --> unpublish data
        // value of 1 --> publish data
        // your code goes here ...
       
    }
    return true;
}

Viel Erfolg, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: MaliRaj

More
2 years 1 month ago #7939 by MaliRaj
Replied by MaliRaj on topic Event für individuelles Visforms Plugin
Hallo Ingmar!
Genial! Danke für die ausführliche Anleitung!
Beste Grüße

Freundliche Grüße aus PM
Heinz

More
2 years 1 month ago - 2 years 1 month ago #7940 by MaliRaj
Replied by MaliRaj on topic Event für individuelles Visforms Plugin
Nach dem Dank eine (fast) kurze Nachfrage:
Wie kann ich aus der Datensatz-Id auf die Formular-Id schließen, ohne alle visformsTabellen durchsuchen zu müssen?? Ist $form oder $fields an der Stelle auch verfügbar?
Da die DatensatzID´s in unterschiedlichen Formularen gleich sein können, bräuchte ich auf "irgendeinem" Wege die $fid. Vielleicht hatte ich das in meiner Erstfrage nicht genau genug beschrieben: Ich möchte "innerhalb" des jeweiligen Formulares auf das FormChangeState-Event reagieren. Gibt es da eine globale Variable oder andere Möglichkeit?
 

Freundliche Grüße aus PM
Heinz
Last edit: 2 years 1 month ago by MaliRaj.

More
2 years 1 month ago #7946 by MaliRaj
Replied by MaliRaj on topic Event für individuelles Visforms Plugin
Ich habe jetzt eine Möglichkeit über Global $_POST bzw. $_REQUEST...filter ... gefunden, die ItemId und FormId in den Array_keys enthält.
Mit Hilfe einer Funktion ist das auch gut händelbar, aber letztlich nur ein Notbehelf.

Freundliche Grüße aus PM
Heinz

More
2 years 1 month ago #7948 by Administrator IV
Replied by Administrator IV on topic Event für individuelles Visforms Plugin
Hallo Heinz,

du verwendest dazu immer die Joomla Framework Klassen.
In deinem Fall enthält das Input Objekt alles was du brauchst:

vi-solutions.de/forum-uploads/factory-ap...JFormChangeState.png

Die FormID erhältst du etwa mit:
\Joomla\CMS\Factory::getApplication()->input->get('fid')

Kleine Bemerkung:
Wäre die Signatur des Event-Handlers 'onVisformsdataJFormChangeState' mit weiteren Parametern versehen, so kämen die dort enthaltenen Daten letztendlich auch nur aus dem Joomla Input Objekt.
Sie würden vor dem Aufruf - etwa aus dem Input Objekt - ermittelt und dann einfach als weitere Parameter an den Event-Handler übergeben.

Was du an dieser Stelle tatsächlich nicht bekommst, ist das komplett geladene Visforms Form Objekt mit allen seinen Feld Objekten und deren gesamter Konfiguration.
Das macht aber an dieser Stelle nur wenig Sinn.

Gruß, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: MaliRaj

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum