Questions tagged [hook]
The hook tag has no usage guidance.
38
questions
1
vote
1answer
21 views
How html title is generated in entry index page in CP
I am trying to find out how HTML title is generated in entry index page in Control Panel.
i know it is generated in src/templates/_elements/element.html file by $this->hook('cp.elements.element',...
0
votes
0answers
46 views
How to hook into root controller to redirect any route based on some criteria?
We have a use case where if our user account has a certain flag that they are redirected to a specific page.
Is there a way to hook into the root controller or some sort of router mechanism such that ...
1
vote
0answers
21 views
How to modifyPaymentRequest() in Commerce 2?
Looks that I really used every functionality in my plugin that changed or has been removed in Commerce 2. :(
I need to modify paypal transactionId and description what i did as follows in Commerce 1:
...
1
vote
1answer
221 views
Webhook plugin & hooking into Contact Form
As my first delve into webhooks I've just installed the Pixel&Tonic Webhooks plugin. I'm trying to send data from a front end contact form to Zapier. The front end form uses the Pixel&Tonic ...
1
vote
1answer
56 views
Can you hook into a Redactor field before render?
I am wanting to hook into all my redactor fields content before rendering and update any inline links to include a title="" attribute. Is it possible to hook into the field before it is rendered? With ...
1
vote
1answer
298 views
Getting current entry element via plugin in Craft 3 without a hook
Is it possible to query the current entry or category element via a Craft 3 plugin/module?
In the 2.6 era, I would use a hook. The Craft 3 iteration of a hook looks something like this:
$...
1
vote
1answer
114 views
How do I edit a dropdown field in the charge.onCharge hook?
I have an invoice that is sent to stripe to be paid. When the thanks.html is shown, I would like the invoices section's invoicePaid dropdown field to change from "No" to "Yes" using the charge....
1
vote
1answer
119 views
Where to call hook modifyImportRow?
I'm using this Import plugin https://github.com/boboldehampsink/import.
It has a hook called modifyImportRow, which would let me process single .csv rows with my custom logic.
In this case I have to ...
1
vote
0answers
43 views
Make fields sortable in CP
I'm displaying list of fields on frontend (using craft.fields.getFieldsByGroupId) and for that purpose I need the fields in group to be in particular order.
Is there a way to add 'order' property to ...
1
vote
1answer
91 views
Can a plugin manually raise another plugin's Event?
I have created an Adjuster which is attached to commerce_lineItems.onPopulateLineItem.
The discount criteria is based on validation of a completely separate coupon API, so I created a permission-less ...
0
votes
1answer
339 views
How to create custom option/action for backend entry lists
Please excuse me for the title.. I have no idea how to describe my problem better - if someone knows a better description for this question feel free to edit it.
I made a screenshot to clarify what I ...
1
vote
1answer
58 views
Plugin Development: intercept Entry before returned to template
Is there a hook in Craft to intercept an Entry before being returned to a (front-end) template? Thinking here of ways we can manipulate what is being returned in the Element Criteria Model without ...
1
vote
1answer
156 views
How to show details on linked entry in CP (another field inside related entry)
I'm using a row layout SuperTable to create a recipe (ingredients are entries). Is there a way to show another field inside the related entry (not just the title) together with the entry title? I need ...
1
vote
1answer
41 views
How should a multi-stage editorial process be implemented in Craft?
I'm building an editorial system on Craft which has 6-8 editorial stages, such as Assignment, Initial Proofing, Secondary Proofing, etc. It seems that the simplest solution would be to have the ...
2
votes
1answer
19 views
Close entry editing after set time (for certain a user group)
I have a group of users who are allowed to create entries and edit them but I want to put a window on how much time they have in which they can edit it. For example, after initial submission they ...
2
votes
1answer
101 views
Insert entry into article field (elementselect?) on a user, with the “onBeforeSaveEntry” hook
I'm having a hard time inserting new content into an elementselect field for a user.
Here's the code I'm working on so far, inside a custom plugin init()
parent::init();
craft()->on('entries....
1
vote
1answer
131 views
How do I hook into Capture form onPost event?
I am writing a new plugin to hook into a POST event from a bespoke form plugin called "Capture". The Capture plugin fires two different events; the code taken from /craft/plugins/capture/services/...
2
votes
1answer
109 views
Plugin add options to entry edition
What I'm trying to do is add two checkbox in the entry edition page, just under the dates or special notes, somewhere here :
Then if the checkbox is checked, I check it with an event and perform an ...
2
votes
1answer
374 views
Where do I put code to use hooks and events from Squarebit's 'Charge' plugin?
I would like to update a specific entry upon the completion of a successful payment through the charge plugin. For this, Charge provides the callback 'charge.onCharge,' as detailed in the 'Hooks & ...
1
vote
2answers
432 views
Add custom column to Entry Type index page
I'm creating a plugin and I've been following the Mijingo Craft plugin development videos. I reached the point where a column was added to the entry index page. I was looking to do something similar ...
2
votes
1answer
335 views
How to use onDeleteEntry?
I currently have a plugin which needs to do things on save and delete entry events. My save entry code is all working perfectly but the onDeleteEntry code doesn't ever fire when I delete an entry.
I ...
1
vote
0answers
58 views
User Group specific asset paths
I've been doing some quite involved work on a site where we want to restrict user access to certain asset paths. Following the post at Assets Folder: Images don't show up I was directed to the ...
0
votes
1answer
88 views
Hooking into event when record deleted from custom plugin
We are using a plugin that has created its own record for storing private messages. When deleting a message, it's calling the delete() method on an instance of the record, which appears to be using ...
1
vote
1answer
367 views
Displaying an array returned from a hook
I'm writing a plugin which has a hook like:
craft()->templates->hook('myHook', function(&$context)
{
return array('hello', 'there');
});
While I can call it in a template with:
{% ...
4
votes
1answer
506 views
Incorporating data from an external database into Craft pages
I'm looking at how best to incorporate various sets of data from another MySQL database into a Craft site. Using the Feed Me plugin would be one way, if the data source had feeds, but I'm thinking ...
4
votes
3answers
661 views
Template Hook + Caching
A portion of my template is being cached, using the standard cache tag:
{% cache %}
Within that cached section of the template, I'm using a template hook:
{% hook 'myTemplateHook' %}
Within that ...
1
vote
1answer
45 views
Hook calls within a loop always get the Entry, not the loop context?
According to the docs, if I call a hook from within my template:
The $context argument will be the current Twig context array, which you’re free to manipulate.
So I have a loop in my template ...
1
vote
1answer
792 views
How can I fire a controller action for a particular route or entry?
So I have an entry that has some content displayed in a template.
However ahead of displaying that entry, I want a plugin's action to fire, which pulls some data in from a third party API that will ...
1
vote
1answer
195 views
Updating index tables' sortable attributes on AJAX
I'm currently writing a plugin enabling users to easily add custom fields to index tables, using the native field layout designer.
My current goal is to have any datetime, boolean, string or number ...
3
votes
1answer
352 views
Element Actions for Entries being viewed from modifyEntrySources
Im using the modifyEntrySources hook in my plugin, when I view the entries based on my custom criteria it doesn't show the checkboxes for element actions, is there a way to get these back or is this a ...
3
votes
2answers
269 views
How to change the display order of columns in Entry List view?
When adding a custom column to an Entry List view using the modifyEntryTableAttributes hook, how would you also set the display order of columns?
3
votes
1answer
314 views
What does the 'modifyEntrySources' hook do?
What does the modifyEntrySources hook do exactly, and when might one use it? Can someone help clarify this please?
1
vote
1answer
383 views
How to change the display of asset fields in the control panel via plugin?
I would like to modify how assets are displayed within asset fields in the control panel's edit entry page, so that thumbnails are larger and the name is not displayed.
After some investigation I ...
2
votes
1answer
494 views
Pixel & Tonic's Contact Form Plugin - POST submissions to Zapier Webhook URL?
I'm still a beginner with PHP so please bear with me. I've installed the Contact Form plugin for Craft by Pixel and Tonic, and have it configured to work as expected.
However, I'd like to have the ...
2
votes
1answer
1k views
Hook in before template gets rendered
The only thing I don't really like about Craft is that I have to fetch and eventually manipulate my entry in the twig template itself.
Is there a way to hook into the current request before the ...
4
votes
1answer
329 views
Hook into rendered templates?
I am hoping to write a plug-in to cache pages as static HTML. Is there a hook that would give me access to the full rendered HTML of a page?
2
votes
0answers
46 views
Hook for Image Transforms [duplicate]
I'm interested in creating a plug-in that creates a new type of transform. Is there a hook/event related to image transforms?
8
votes
1answer
1k views
How do I handle named route variables passed to a controller?
I'm writing a plugin that uses the registerSiteRoutes hook to create some new routes, and passes those routes to some controllers. In these routes, I have a few pieces of the URL that I'm capturing as ...