-
Posts
5,008 -
Joined
-
Days Won
333
Everything posted by Robin S
-
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.
-
Hi @adrian, Not a major, but the Console panel layout is a bit messed up when the panel is opened as a window.
-
We are getting off-topic here, but... If @mindplay.dk is not actively maintaining the module then I think it would be good to update it. It would be cool to have as an option in Tracy, or the module could be forked. I found that the module isn't working in PW3 where a namespace is declared at the top of template files. I had to modify the module code to add the namespace to stubs.php because the FileCompiler does not compile this file. Also, I'm probably overlooking something but I can't see why the module needs to rebuild the stubs file after every Session::redirect and every ProcessPageView::finished. I think that comment is due to a misunderstanding of what the module is for. The module only adds code completion to $page for field names in the current template - it isn't intended to provide code completion for all API variables (for that you have to add a DocBlock in every template file with tags for each API variable).
-
@Vigilante, please use code blocks for your code examples. If you really need to do it this way then you could do... <?php foreach($parents as $parent): ?> <?php $children = $parent->children("id=$everything"); // PageArray dereferenced as string of pipe-separated IDs ?> <?php if(count($children)): ?> <section> <h2><?= $parent->title ?></h2> <ul> <?php foreach($children as $child): ?> <li><?= $child->title ?></li> <?php endforeach; ?> </ul> </section> <?php endif; ?> <?php endforeach; ?> ...but it's not very efficient. Instead, I suggest you don't need the $parents PageArray and should just work on sorting the $everything PageArray. For example: // Sort by parent in the selector for $everything $everything = $pages->find("template=basic-page, sort=parent"); // Initialise $parent_title $parent_title = ''; foreach($everything as $one) { // By default, this is not a new section $new_section = false; if($one->parent->title !== $parent_title) { // If the parent title of $one is different to the existing $parent_title // then this is a new section $new_section = true; // Set $parent_title $parent_title = $one->parent->title; } // If this is a new section and $one is not the first item in $everything // close ul and section from previous section if($new_section && $one !== $everything->first) echo "</ul></section>"; // If this is a new section, add the open section, heading and open ul if($new_section) echo "<section><h2>$parent_title</h2><ul>"; // Output the li echo "<li>$one->title</li>"; // If $one is the last item in $everything then close the ul and section if($one === $everything->last) echo "</ul></section>"; } If you need some custom sort of the parents then you could loop through $everything and add a custom sort property to each item, then sort $everything by the custom property. Not exactly the same, but this post shows the general idea:
-
I'm wondering about this part... If these options (checkboxes) are added dynamically, are all the options also defined in the selectable options for the Select Options field? You cannot save an option to a Select Options field if it is not one of the pre-configured selectable options. If you want to dynamically add to the selectable options then this reply has some example code:
- 3 replies
-
- 1
-
-
- checkboxes
- selectableoptionarray
-
(and 1 more)
Tagged with:
-
Front-end custom form: how to retrieve an inputfield css class
Robin S replied to Federico's topic in General Support
When you can find a setting in admin and you want to know what the property name will be in API, a handy trick is to hover the collapse toggle of the setting. When $config->debug = true you will see the name of the input appear, and 99% (all?) of the time that will be the property name in the API. And Tracy will give you the whole shebang: -
Front-end custom form: how to retrieve an inputfield css class
Robin S replied to Federico's topic in General Support
@Federico, I'm not sure I completely understand your question, but if you want to know what inputfield type is used for a Page Reference field you can get that from the "inputfield" property. The type setting in admin: Getting the type via InputfieldPage using the API: // $inputfield is InputfieldPage object $inputfield = $pages(1234)->getInputfield('YOUR_PAGE_REFERENCE_FIELD'); // $type is 'InputfieldSelect' $type = $inputfield->inputfield; P.S. Are you using Tracy Debugger? Things are a lot easier once you start using this module. You can dump an object (e.g. an inputfield) and explore all its properties. -
Hi @tpr, AOS has a stylesheet rule... html.noFilenameTruncate i.fa-file-image-o, html.noFilenameTruncate .InputfieldFileInfo i { left: -21px !important; top: 3px; float: left; } ...but this is too broad and affects the FontAwesome icon 'file-image-o' outside of the image inputfield when the noFilenameTruncate option is active (e.g. in the icon picker or in the module listing if that icon is used for a module).
-
Well, you could say that PW has a gap when it comes to front-end anything. I don't know if there's a good authoritative document explaining this anywhere, but I think it's fair to say that part of the PW philosophy is that the core does not get involved with the front-end of your site. Depending on how experienced you are with front-end development this is either something that makes your job easier or more difficult. So you have all the freedom (likewise, responsibility) to do whatever you want with your front-end and PW will never mess it all up for you (likewise, help build your front-end for you).
-
You can nest as many regions as you want, so long as they are all defined in _main.php. In other words, the only limitation is that you can't define new regions in a template file that is then included in another template file. So despite the first blog post on Markup Regions saying... ...Ryan later decided to remove this feature. If you are concerned about performance remember to use markup region hints to make the regions parsing more efficient.
-
Disable frontend-editing if other format then HTML?
Robin S replied to dragan's topic in API & Templates
Are you using Option A? If so, switch to Option B, C or D and then you'll only get editable fields where you ask for them in your template file. -
That's a great tip, will do that myself in future. So often an otherwise nice typeface has a weird unrecognisable ampersand or something. Cases in point... http://www.myfonts.com/fonts/font-fabric/nexa/regular/glyphs/716952/445 http://www.myfonts.com/fonts/intelligent-foundry/averta/regular/glyphs/756381/1184
-
Admin users: when migrating a live site to a new host, and you don't want users making changes to DB content during the migration. Front-end users: temporarily suspending member-only privileges for a user (e.g. because of some infraction).
-
This is a question about using the system notices: $this->message(), $this->warning(), $this->error(). If I have a method that is is called by an AJAX request, I can't trigger a system notice immediately (would be great if this was possible). But is there some way to "queue" the notice so that it appears on the next admin page load? P.S. I know about the System Notifications module, but it's of no use if you need AJAX notices for a publicly shared module as there is no guarantee that the user will have System Notifications installed. Edit: found it... $session->message() $session->warning() $session->error()
-
- 2
-
-
That did the trick. Another little thing I noticed is your font stack: font-family: "Hind Madurai", "woodford_bourne", sans-serif; You are specifying "Hind Madurai" from Google Fonts as the first preference, but this is not actually rendered anywhere (that I could see) and instead all the text renders in the first fallback "woodford_bourne" which you are self-hosting. So maybe "woodford_bourne" is actually the typeface you actually intend to use and specifying/loading "Hind Madurai" is unnecessary?
-
I agree it would be handy, but that would be a completely different thing to what this module is doing. This module is essentially just using Pageimages::add() on the submitted URLs, and that method has no support for clipboard data. I don't think I want to disappear into the browser clipboard rabbit-hole with this module. I'll have a think about it. It would make the module significantly more complex and I'm not sure how much time I want to put into it. Maybe if I get bored sometime...
-
Very nice! One issue I noticed is that if you scroll down one increment of the mousewheel, as well as triggering the animated scroll past the hero section the text below is also scrolled, meaning the first couple of lines are already obscured behind the header. How many text lines are scrolled perhaps depends on the OS mouse settings. Maybe you could somehow capture the first mouse scroll interaction so that it only triggers the hero scroll and not scroll the rest of the page content?