-
Posts
10,896 -
Joined
-
Last visited
-
Days Won
348
Everything posted by adrian
-
module Module ImageReference - Pick images from various sources
adrian replied to gebeer's topic in Modules/Plugins
I feel like this should be a good idea, but at the moment I am not quite understanding how it will improve the current interface because it already shows thumbnails of images on the selected "other" page. Could you maybe describe in more detail please? -
Hi everyone. I've just committed v2.0.0 of this module with some BREAKING CHANGES. The breaking change is the removal of the "Enable for API" option. After lots of discussion and testing with @Robin S's help we decided that it's best that this module doesn't handle renaming via the API - it's not really its intended purpose, but there are also too many complications when it comes to dealing with hooks that save pages. This has allowed me to simplify the module significantly as well as now all the renaming is done via JS which is more inline with how the PW core sets the page name when you initially title a page. This update also adds individual Exempt Roles settings for each of relevant settings, rather than the old overarching option. I have also done quite a bit of cleanup and refactoring, but all those should be taken of via the module's upgrade() method. That said, I still recommend taking a good look over the settings page to make sure it's still showing what you expect and that the module's behavior is still correct for your needs. Please let me know if you find any problems. Happy Holidays all!
-
This is an example of something I do with Profields Table for replacing Twilio message and error codes with links to the entry in the logs on the Twilio site. You should be able to adapt to your needs. // link SID and error code columns in User message tables to the Twilio log entry $this->wire()->addHookAfter('InputfieldTable::render', function($event) { if(!in_array($event->object->name, array('received_messages', 'incoming_messages', 'queued_messages', 'undelivered_messages', 'failed_messages'))) return; $text = $event->return; if(preg_match_all("/<td>(S|M)M(.*?)<\/td>/", $text, $matches)) { foreach($matches[0] as $match) { $sid = str_replace(array('<td>', '</td>'), '', $match); $text = str_replace($match, '<td><a href="https://www.twilio.com/console/sms/logs/'.$sid.'">'.$sid.'</a></td>', $text); } } if(preg_match_all("/<td>([0-9]{1,})<\/td>/", $text, $matches)) { foreach($matches[0] as $match) { $errCode = str_replace(array('<td>', '</td>'), '', $match); $text = str_replace($match, '<td><a href="https://www.twilio.com/docs/api/errors/'.$errCode.'">'.$errCode.'</a></td>', $text); } } $event->return = $text; });
-
Hi @tires - I'm sorry, it still works fine here. I just tested with: https://www.youtube.com/watch?v=aqz-KE-bpKQ Any chance you can give me access to the site to take a look?
-
All my fault - it actually was an issue with those checks on the line you pointed out. The difference on my test site was that even though I didn't have the tracy-home-dev permission checked, it was created so the conditional was returning true. On your site that permission didn't exist so it wasn't proceeding. The first check now also checks for the "all" version of that permission before checking if the current user has it.
-
Thanks @alexmercenary - I found the issue and it should be all fixed now. I have updated your site to the new version of Tracy that includes the fix. Let me know if you have any other problems.
-
Sorry about that @Robin S - my logic didn't properly account for API calls triggered from the backend, as is the case with this hook of yours. I assume you are saving the page via the admin? I should have a fix shortly, but please confirm that you are saving via the admin.
-
It should work, although it's not quite that simple - that's why that line of code you pointed to uses a custom method for seeing if the superuser has the required permission. I just tested here - adding my editor role (which has the tracy-all-dev permission) to my superuser user and it works as expected still. Any chance you could debug a little to see where it's failing? Either that, or is it possible to give me access to the admin of the site so I can take a look?
-
Tracy doesn't create those automatically, so yes you do need to create manually. Note that in your last screenshot you are showing the template, rather than the template filename. What does the filename row in the Template Info section show?
-
It all seems to be working fine here. I have these Tracy related permissions: I have applied the tracy-all-dev to the "editor" role and when I visit the home page with a user with the editor role, they see the home page with the home-dev.php template file:
-
Oh right - sorry, I forgot about that option ? Let me take a look.
-
Do you have a template named "all" ? or are you expecting it to work for all templates?
-
@gebeer - no time to see what you've done vs what I have done in the past, but I just wanted to quickly link to: in case it's at all useful. Maybe your approach is the same or better?
-
@Robin S - on mobile so can't test but have you tried the Dumps Recorder panel? If that doesn't help I'll try to investigate later.
-
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
-
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
Not your fault at all - took me a while, but turns out it was my definition of a field in SettingsFactory that was causing the problem ? All sorted now and the new version works great for Settings Factory as well - really cool - I especially love the ability to upload directly via that field and it automatically reloads the available images after closing the modal. -
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
It wasn't created that way - just a regular image field. Even after deleting it I am still seeing the error - will have to dive deeper to see where it's originating. -
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
Yeah, I did. I just uninstalled it and that error is now gone, but I am now seeing: and having real problems getting rid of it. -
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
Really short on time, but wanted to take a quick look. So far looks really great - thank you! I noticed this error - only occurs if the child page doesn't have images available. Also, I am wondering about the radio buttons as a way to choose the fields that images can come from. I would have thought checkboxes were better to allow for multiple fields. This may be for multiple fields on the one page/template, but I can see it also being useful for different pages with different templates that have different image fields. Does that make sense? -
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
@gebeer - that all sounds brilliant - thanks again so much for this - it's going to be an awesome solution! -
Sorry, but uninstalling Tracy doesn't help replicate it for me either. I am curious - is this a new install of BCE, or did you upgrade from an older version? I get the feeling you may have upgraded from a version before the pagesToInclude option existed and there is a problem with the defaults not making it through when using separately configurable pages. Would you mind uninstalling and reinstalling BCE to see if that fixes it?
-
Could you do me a favor please? Do you have Tracy installed? If you could enter: bd($currentData); after line 100 and post a screenshot of the output. It should look something like this: The key thing is that you will need to enable the Dumps Recorder panel in Tracy and after you click the export button, you'll need to reload the page to see the results in the Dumps Recorder panel. Thanks!
-
Hi @pullasuti - welcome to the forums! I can't seem to reproduce this. Are you exporting a parent with separately configurable settings, or relying on BCE's default module settings? What version of PW and PHP are you using?
-
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
I think "2" for sure. I think the thumbnails should be as you currently have them when there is more than one page with available images - in collapsed inputfields - one for a defined filepath, one for the current page, and one for each of the other available pages - which of these are shown of course will depend on the field's settings. -
module FieldtypeImageFromPage pick an image from various sources
adrian replied to gebeer's topic in Modules/Plugins
I guess that's why I was thinking if the module was simply named "ImagePicker" - then it could allow picking from disk path, pre-defined pages, or the current page - would that model / approach make sense?