-
Posts
5,039 -
Joined
-
Days Won
340
Everything posted by Robin S
-
If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it. This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click. CKEditor Link Files Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited. Features Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. There is an option in the module config to include files from Repeater fields in the edited page. Nested Repeater fields (files inside a Repeater inside another Repeater) are not supported. Installation Install the CKEditor Link Files module. For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field. http://modules.processwire.com/modules/cke-link-files/ https://github.com/Toutouwai/CkeLinkFiles
- 25 replies
-
- 19
-
-
Welcome to the forums @mikhail $page->find() could be useful here. I think something like this should do the trick: // This category plus all child categories under it $categories = $page->find()->prepend($page); $pano_results = $pages->find("location_category=$categories, sort=-shoot_date, limit=10");
-
Noooooooooo! You have been seduced by some other sexy CMF??? (The hussy!) Tell me it isn't true!
-
Hi @tpr, Could you please give some comment about where things stand with AOS with regard to AdminThemeUikit? Have you done much testing with the Uikit theme and would you say that AOS is officially supports the Uikit theme at the moment? So far I have been holding off switching to the Uikit theme - for a few reasons, one of which is that AOS is a pretty important part of my custom profile and I want to be sure the module works well with the theme before I switch my clients over to it. I haven't tested AOS much with the Uikit theme but at a quick glance I noticed a few things that made me think that the theme might not be officially supported by AOS yet. AOS toggle/config link doesn't align with the left edge of the content container: Module config icon position is a bit off and icon is fuzzy (wrong size?): Also, the Escape key does not clear the notices. No pressure if AOS is not ready for AdminThemeUikit yet - just wanted to check.
-
Selector Fieldtype uses template id rather than name
Robin S replied to FlorianA's topic in API & Templates
The problem is here. The description of InputfieldSelector/FieldtypeSelector is "Build a page finding selector visually" (my emphasis). The inputfield returns a string that is suitable for using with the PW PageFinder - so you can use it with methods that query the database such as $pages->find($selector) or $page->children($selector) but it isn't guaranteed to work with in-memory selectors like $some_pagearray->find($selector), $some_pagearray->not($selector), etc. In your case a simple solution would be to use your Selector field to define the selector for pages that will appear in the menu (rather than what you don't want to appear in the menu). So you would set this in your Selector field... template > Not Equals > event ...and then use it in your template like this... function getSettings() { return pages()->get('/site-settings/'); } $home = $pages->get('/'); foreach ($home->children(getSettings()->menu_filter) as $childPage) { // ... } -
You learn something new every day.
-
Looks cool, thanks! I think it would be a good idea to include some advice that when using on a live server users should password protect the directory that kickstart.php is uploaded to, until the install process is completed and kickstart.php is removed. Otherwise there is a security risk that a third-party might access the script and thereby be able to upload any files of their choosing. Password protection info: Apache cPanel (essentially just a GUI for Apache basic auth)
-
Fails in what way? What is the error that your client is seeing? Could you clarify what you mean by child and parent? Child and parent pages? Not sure how that fits with the code you've shown. What type of field is "times"? I think this should be: $pages->addHookAfter('saveReady', function($event) { You only use "addHook" if you are adding a new method or property to the class. You don't need to do $p->of(false) for the page being saved in a saveReady hook because output formatting is already false at this point. But it doesn't do any harm either and it isn't related to the problem you're having. Nothing is ever really mandatory when it comes to fields. Setting the "required" option for a field just means that the user will see an error when they save a page with this field empty. But the page is still saved with the required field in its empty state. So you should always account for the possibility that a required field may be empty. You could test what happens in your hook when you save a page with "startdate" empty. Perhaps that causes the issue?
-
Those attributes are not useless - their use is that they mitigate against reverse tabnapping vulnerabilities for links that have target="_blank". https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/ https://mathiasbynens.github.io/rel-noopener/
-
In /site/ready.php: $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { $lister = $event->object; $lister->nativeDateFormat = 'd.m.y'; }); See here for the format options: https://processwire.com/api/ref/datetime/date/
- 1 reply
-
- 7
-
-
Inputfield Dependencies seem to work okay with front-end editing, but you need both fields to be present in the editor window... Field 1: The field that has the dependency applied to it Field 2: The field whose value Field 1 is dependent on So you would need to use front-end editing option C or D with both fields specified: <edit field="field_1,field_2"> ... </edit> <div edit="field_1,field_2"> ... </div>
- 1 reply
-
- inputfield
- dependencies
-
(and 2 more)
Tagged with:
-
I don't think there is going to be an satisfying solution for this. Front-end editing is nifty for simple needs but there are many situations where it is a poor substitute for editing a page within the dedicated Page Edit environment in admin. I think dealing with empty fields might be one of those situations. The simplest thing would be just to train your editors to reload the page if they accidentally save an empty field. If you want to try other things, you'll have to approach it via Javascript because there isn't any hookable method in PageFrontEdit.module that will be useful here. You could give this a go: $('body').on('pw-reloaded', 'span[data-name="informations"] .pw-edit-copy', function() { if(!$(this).html().length) $(this).siblings('.pw-edit-orig').html('<p>No infos.</p>'); });
-
The module has been approved for the directory now, and the link is in the first post.
- 17 replies
-
- 1
-
-
- module
- form builder
-
(and 1 more)
Tagged with:
-
@kongondo, @gmclelland, I think @dragan is referring to pasting the URL in the OS dialog you get after clicking "Choose file":
-
New AJAX-driven Inputfields - JS problems in core inputfields
Robin S replied to bcartier's topic in General Support
Yes, I think so. The method comment says... ...so it should be possible to get the field. E.g. public function renderReady(Inputfield $parent = null, $renderValueMode = false) { $field = $this->hasField; if($field) { //... } //... } -
@ryan, in the blog post you give an example of the need for the image actions feature: What do you think about adding an interface that allows multiple images to be selected and then an action applied to those selected images? There was a question in the forums a while back about how tags could be applied to multiple images: I bookmarked this in my "to do" list because it's something that would be useful to implement. If there was an interface for selecting multiple images then maybe the new image actions feature could be a solution to this. Also, do you think it would be possible to create actions that, in a first step, open a dialog where options could be selected? So for example, if the action was "Move image to field" there could be a dropdown to select image fields on the page? This would be better than needing to have separate actions for each option. Maybe you could give a tutorial on creating image actions in a future blog post?
-
Love the image actions feature, thanks! Especially looking forward to this one... ...as I had a need for this recently. I don't intend to give users access to the "special effect" options (B&W and sepia) for the same reason I wouldn't give users the ability to change fonts or text colours - there's always some editor who considers themselves an "artist" and will take a carefully designed site and turn it into a dogs breakfast. In case anyone else feels the same, it's simple to remove these with a hook in /site/ready.php: $wire->addHookAfter('InputfieldImage::getFileActions', function(HookEvent $event) { $actions = $event->return; unset($actions['bw']); unset($actions['sep']); $event->return = $actions; });
-
New AJAX-driven Inputfields - JS problems in core inputfields
Robin S replied to bcartier's topic in General Support
If you add a renderReady() method to your inputfield module and load the dependencies there then they should be available for all inputfield usages including repeaters. Check out the Inputfield class, and the AsmSelect inputfield as an example. -
This is most likely caused by a Javascript error. Open the JS console in your browser dev tools and you should see an error message that sheds some light on the problem. Looking at your Extra Plugins screenshot, it looks like you have not included the required dependencies for the Widget plugin:
-
Adding and Assigning Fields without using gui?
Robin S replied to neildaemond's topic in API & Templates
@nickngqs, a few more options for executing API code: Tracy Debugger's Console panel Tracy Debugger's Snippet Runner panel Admin Actions module -
Possible to layout pages this way? (Page Tree Q)
Robin S replied to joer80's topic in General Support
@Macrura, I'm intrigued by the "Flagged Works" section in your dashboard screenshot. Is that some kind of automatic pre-flight that checks user edits for possible errors? Could you explain about it? -
[solved] Changing permissions of a children of admin template
Robin S replied to nickngqs's topic in General Support
Access for Process modules is managed using the 'permission' item in the getModuleInfo() array. You can also create the permission and the page for the Process via getModuleInfo(). You'll need to uninstall then reinstall your module for the settings to take effect. See Ryan's ProcessHello demo module. And the comments in the Process class.- 4 replies
-
- 4
-
-
- children
- permissions
-
(and 1 more)
Tagged with:
-
For the "Selector string" option I think the correct syntax is: has_parent=page.parent
-
Create InputfieldPageListSelectMultiple inside module
Robin S replied to dragan's topic in Module/Plugin Development
It looks like the JS and CSS dependencies for InputfieldPageListSelectMultiple are not included in the page. Probably because ProcessPageLister::renderResults is called via AJAX after the page has already loaded, at which time it is too late to tell PW that the dependencies are needed in the <head>. You could try forcing the dependencies to be loaded in a hook to ProcessPageLister::execute... $wire->addHookAfter('ProcessPageLister::execute', function(HookEvent $event) { if($this->config->ajax) return; // not needed for AJAX-loads $inputfield = $this->modules->get("InputfieldPageListSelectMultiple"); $inputfield->renderReady(); // load JS/CSS dependencies }); -
@tpr, I've been having a look at getting the field edit links working inside repeaters. The solution is pretty simple. At line 2342... if ($field = $inputfield->hasField) { //... And because of the suffix added to the name of inputfields inside a repeater I think it would be good to make this change at line 2354... $editFieldTooltip = '<em class="aos_EditField">' . $field->name . '<i class="fa fa-pencil"></i></em>'; ...to use $field->name instead of $inputfield->name.