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

[5]log edit contact from frontend #44596

Open
wants to merge 6 commits into
base: 5.3-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__action_log_config` (`type_title`, `type_alias`, `id_holder`, `title_holder`, `table_name`, `text_prefix`) VALUES
('contact', 'com_contact.form', 'id', 'name', '#__contact_details', 'PLG_ACTIONLOG_JOOMLA');
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__action_log_config" ("type_title", "type_alias", "id_holder", "title_holder", "table_name", "text_prefix") VALUES
('contact', 'com_contact.form', 'id', 'name', '#__contact_details', 'PLG_ACTIONLOG_JOOMLA');
20 changes: 20 additions & 0 deletions components/com_contact/src/Controller/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\Mail\Exception\MailDisabledException;
use Joomla\CMS\Mail\MailTemplate;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\String\PunycodeHelper;
Expand Down Expand Up @@ -456,4 +457,23 @@ protected function getReturnPage()

return base64_decode($return);
}

/**
* Method to trigger the onContentAfterSave event.
*
* @param BaseDatabaseModel $model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
{
if ($model === null || $validData === null) {
throw new \InvalidArgumentException('Model and validData cannot be null');
}

$this->app->triggerEvent('onContentAfterSave', ['com_contact.form', (object) $validData, false, $validData]);
alikon marked this conversation as resolved.
Show resolved Hide resolved
}
}
3 changes: 2 additions & 1 deletion installation/sql/mysql/extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ INSERT INTO `#__action_log_config` (`id`, `type_title`, `type_alias`, `id_holder
(19, 'application_config', 'com_config.application', '', 'name', '', 'PLG_ACTIONLOG_JOOMLA'),
(20, 'task', 'com_scheduler.task', 'id', 'title', '#__scheduler_tasks', 'PLG_ACTIONLOG_JOOMLA'),
(21, 'field', 'com_fields.field', 'id', 'title', '#__fields', 'PLG_ACTIONLOG_JOOMLA'),
(22, 'guidedtour', 'com_guidedtours.state', 'id', 'title', '#__guidedtours', 'PLG_ACTIONLOG_JOOMLA');
(22, 'guidedtour', 'com_guidedtours.state', 'id', 'title', '#__guidedtours', 'PLG_ACTIONLOG_JOOMLA'),
(23, 'contact', 'com_contact.form', 'id', 'name', '#__contact_details', 'PLG_ACTIONLOG_JOOMLA');
richard67 marked this conversation as resolved.
Show resolved Hide resolved


-- --------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion installation/sql/postgresql/extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ INSERT INTO "#__action_log_config" ("id", "type_title", "type_alias", "id_holder
(19, 'application_config', 'com_config.application', '', 'name', '', 'PLG_ACTIONLOG_JOOMLA'),
(20, 'task', 'com_scheduler.task', 'id', 'title', '#__scheduler_tasks', 'PLG_ACTIONLOG_JOOMLA'),
(21, 'field', 'com_fields.field', 'id', 'title', '#__fields', 'PLG_ACTIONLOG_JOOMLA'),
(22, 'guidedtour', 'com_guidedtours.state', 'id', 'title', '#__guidedtours', 'PLG_ACTIONLOG_JOOMLA');
(22, 'guidedtour', 'com_guidedtours.state', 'id', 'title', '#__guidedtours', 'PLG_ACTIONLOG_JOOMLA'),
(23, 'contact', 'com_contact.form', 'id', 'name', '#__contact_details', 'PLG_ACTIONLOG_JOOMLA');


SELECT setval('#__action_log_config_id_seq', 23, false);
Expand Down
4 changes: 2 additions & 2 deletions plugins/actionlog/joomla/src/Extension/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ public function onContentAfterSave(Model\AfterSaveEvent $event): void
$messageLanguageKey = $defaultLanguageKey;
}

$id = empty($params->id_holder) ? 0 : $article->get($params->id_holder);
$id = empty($params->id_holder) ? 0 : $article->{$params->id_holder};

$message = [
'action' => $isNew ? 'add' : 'update',
'type' => $params->text_prefix . '_TYPE_' . $params->type_title,
'id' => $id,
'title' => $article->get($params->title_holder),
'title' => $article->{$params->title_holder},
alikon marked this conversation as resolved.
Show resolved Hide resolved
'itemlink' => ActionlogsHelper::getContentTypeLink($option, $contentType, $id, $params->id_holder, $article),
];

Expand Down