-
Posts
4,928 -
Joined
-
Days Won
321
Everything posted by Robin S
-
When adding a new module to the directory, after completing the first step where the link to the GitHub repo is entered, on the second step all the module information fields seem to be pre-populated with info from a different module of mine that is already in the modules directory. Is that normal? It's only the second module I have submitted so I'm not sure. I don't want to end up editing the info for the existing module instead of adding the new module.
-
Thanks for adding the Lister hover action buttons - something I've been wanting for a while. It's working for me in Lister Pro, but I do see some error notices too - not sure if this is what @adrian is referring to above. PHP Notice: Undefined variable: listerType in ...\modules\AdminOnSteroids\AdminOnSteroids.module:759 PHP Notice: Undefined index: in ...\modules\AdminOnSteroids\AdminOnSteroids.module:759 PHP Notice: Undefined variable: listerType in ...\modules\AdminOnSteroids\AdminOnSteroids.module:761 Would it be possible to activate the hover buttons for Lister Pro independently from the other Lister tweaks? The reason being that I'd rather set the columns for the Find and Users lister in Lister Pro and the AOS Lister columns feature interferes with this. Edit: what I mean is could there be checkboxes to activate the AOS Lister columns feature rather than the columns feature being active by default when "ListerTweaks" is checked? Not an AOS problem as it happens when the action buttons show on click too, but the columns jump around as the hovered row changes:
-
<?php if($tab_size == 'too big') { use \CSS; $to_change->it(); } else { $it_looks = 'stupid'; } ?> When pasting code indented with tabs into the forum the indents are too large. It's simple to fix with a bit of CSS: pre { -moz-tab-size: 4; tab-size: 4; } Could someone with the necessary access add this? The big indent bugs me so much I usually find/replace the tabs with spaces when posting code. And as is universally agreed by all quality coders: tabs are much better than spaces
-
Updated to v0.0.2. This version simplifies the module somewhat and you no longer need to select templates in the config.
-
I'm not sure what's the right way to use that. This gives me: syntax error, unexpected '/' $this->pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); /Tracy/Debugger::barDump($page); }); Do you remember which version of Tracy Debugger you introduced the Live dumps? Might be easier for me to roll back to an older version.
-
Hi @adrian I've been noticing something odd when dumping the $page variable inside a hook. I've noticed it when hooking several different methods, but take this hook for example: $this->pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); bd($page, 'page'); bd($page->name, 'page->name'); }); In this hook $page should be the page that is ready to be saved - let's say I am saving the Home page. But when I save the Home page in the admin, the dumped $page variable is for the "Edit" page (ProcessPageEdit). Which is weird, but what makes it weirder is that the subsequent dump of $page->name shows "home" not "edit". Any ideas on what is going on here?
-
It looks like you have some filters set in the Users lister. Does the error still occur if you remove the filters? Also, the title of your post is a little unclear - you have added "user-admin-artist" as a permission and not the name of a role, right? Just to confirm, you followed a procedure like this... Installed user-admin permission: Access > Permissions > Add New > Install predefined system permissions > user-admin Installed user-admin-all permission: Access > Permissions > Add New > Install predefined system permissions > user-admin-all Installed user-admin-artist permission: Access > Permissions > Add New > Install predefined system permissions > user-admin-artist Gave user-admin and user-admin-artist permissions to a role: Access > Roles > artist (or whatever) > checked 'user-admin' and 'user-admin-artist' Welcome to the forums BTW
-
Thanks for the update. In Firefox the jumplinks show the green highlight but aren't triggering a scroll. In IE11 there is no highlight or scroll.
-
Troubleshoot/test sending email from PW
Robin S replied to modifiedcontent's topic in General Support
First thing would be to check that those two "if" tests are being passed. You can do this by logging a message after each test. Or it's really easy with Tracy Debugger: $fu->addHookAfter('FrontendUser::save', function($event) use($fu, $input) { if($event->return === true) { bd('test one passed'); if(!empty($input->post->password) && !count($fu->form->getErrors())) { bd('test two passed'); // the rest of your code } } }); -
@Jennifer Stock, I've been working on a module for this purpose for a while now. Figured it's time to finish it off and release it. Find it here:
-
ConnectPageFields Allows the connecting of two related Page fields so that changing one updates the other. Purpose of module An example: suppose your website is about movies. You have a template "movie" with Page field "actors". For each movie you add the actors that appear in the movie. All good, but what if you want to find results like... the 10 actors who have appeared in the most movies actors who haven't appeared in any movies since 1990 You cannot retrieve these pages with a single efficient $pages->find() query, and must load a large PageArray into memory in order to iterate or filter it. For the sake of making these types of queries more efficient you could structure your templates/fields so that movies are added to actors instead, but this may be a less comfortable workflow and can run into equivalent problems (e.g. "find the 10 movies with the largest cast"). The solution is to have a two-way relationship so that movie pages have an "actors" Page field and actor pages have a "movies" Page field. This module will keep these two Page fields in sync so that adding "Ryan Gosling" to "Drive" automatically adds "Drive" to "Ryan Gosling". Also, you can select the same Page field in both Page field A and Page field B. For example, create a "Related" Page field for related pages. Choose "Related" for both fields in a pair in the module config. Now when you add "Orange buffoon" to Related for "Donald Trump", "Donald Trump" is automatically added to Related for "Orange buffoon". Usage Install the ConnectPageFields module. If you haven't already done so, create the two Page fields you want to connect and add them to templates. In the module config select the two Page fields in a "Connected field pair" row as Page field A and Page field B. You can add rows as needed using the "Add another row" button. Troubleshooting Make sure you have set the "Selectable Pages" settings for each Page field correctly: The settings for Page field A should allow pages using the template(s) that Page field B has been added to. The settings for Page field B should allow pages using the template(s) that Page field A has been added to. http://modules.processwire.com/modules/connect-page-fields/ https://github.com/Toutouwai/ConnectPageFields Module config: Demo showing how changing one Page field updates the other:
- 90 replies
-
- 40
-
I was wrong about the bug in PageTable - I misinterpreted what the purpose of the 'reloaded' event was. So unfortunately there's no event that's guaranteed to trigger when the inputfield does an AJAX reload. Instead we have to check the PageTable field with every ajaxComplete(). But that's not actually a bad thing because we want the check to fire if the PageTable was inside an AJAX loaded field. If you placed a modified InputfieldPageTable in /site/modules/ please remove this and install LimitPageTable v0.0.2: LimitPageTable.zip 1. This is straightforward - in "Table fields to display in admin" just use template.label instead of template, and change the module to match against tpl_label: return $(this).text() == tpl_label; I considered making this the default for the module but I don't like the header given to the table column when this option is set. 2. Not sure what you mean here - the button is disabled in the PageTable field, isn't it?
-
I started changing over my default site profile that I use as a base for new projects to use the functions API and region() function. Then I realised that neither of these will suit me because the functions can't be interpolated in strings the way variables can. I much prefer string interpolation over concatenation - I find it more concise and easier to read. The main attraction to me was the IDE code completion. Pasting the following at the top of each template file does the trick and isn't much hassle. namespace ProcessWire; /** * ProcessWire API variables * * @var $page Page * @var $pages Pages * @var $modules Modules * @var $user User * @var $users Users * @var $permissions Permissions * @var $roles Roles * @var $input WireInput * @var $sanitizer Sanitizer * @var $session Session * @var $log WireLog * @var $cache WireCache * @var $datetime WireDateTime * @var $files WireFileTools * @var $mail WireMail * @var $config Config * @var $database WireDatabasePDO * @var $fields Fields * @var $templates Templates * @var $languages Languages * @var $wire ProcessWire * @var $procache \ProCache **/ A similar thing can be done for region variables to avoid IDE 'undefined variable' notices. /** * Template region variables * * @var $headline * @var $content * etc **/ I've set these up as a file template in PhpStorm so they appear automatically for each new PHP file created in the project.
-
This seemed like a fun challenge so I put together a little proof-of-concept module. For this to work you need to do a couple of things: 1. Correct a bug in InputfieldPageTable.js - hopefully will be fixed in the core soon. In the meantime you can copy the InputfieldPageTable directory to /site/modules/ and change line 18 of InputfieldPageTable.js to: Edit: sorry, I was wrong about this 2. Include "template" or "template.label" in "Table fields to display in admin" for your PageTable field. A screenshot of the module config: Download v0.0.3: LimitPageTable.zip
-
The docs for MSN do cover this. If your parent page has a particular template you can use the xtemplates and xitem_tpl options. For more advanced targeting you can use a hook, for example: $nav = $modules->get('MarkupSimpleNavigation'); $nav->addHookAfter('getItemString', function($event) { $page = $event->arguments('page'); if($page->children->count()) { $event->return = "<button class='$page->name'>$page->title</button>"; } });
- 10 replies
-
- 2
-
- markupsimplenavigation
- drop down menu
- (and 2 more)
-
Just looked at this issue recently. This seems to do the job: $this->addHookAfter('FieldtypeRepeater::wakeupValue', function($event) { $field = $event->arguments('field'); // Only for a particular repeater field // Could also use page argument for other tests if($field->name !== 'my_repeater') return; $pa = $event->return; $pa->sort("-created"); // or whatever sort you want $event->return = $pa; });
-
Could this go in a linked JS file rather than directly in the template?
-
Could be you need to increase post_max_size
-
iOS devices actually handle links with hover states quite well - first touch triggers hover behaviour. For Android/cross-platform check out @bernhard's solution: Using a hash in a link href is not great because it usually triggers a page jump when clicked. Using href="javascript:void(0)" is a bit better, but if you don't actually have an href you should probably be using a button element instead of a link. But my suggestion is if you're using Javascript to trigger your menu then just leave the parent href untouched and use preventDefault() in your Javascript. $('#my_link').click(function(e){ e.preventDefault(); // no page reload // show dropdown menu });
- 10 replies
-
- 1
-
- markupsimplenavigation
- drop down menu
- (and 2 more)
-
A typical way to do this sort of menu doesn't involve a hash in the parent href, but rather you use CSS to show/hide the nested lists of child pages. li > ul { display:none; } li:hover > ul { display:block; }
- 10 replies
-
- 1
-
- markupsimplenavigation
- drop down menu
- (and 2 more)
-
How about... foreach($pages->get("/filme/")->children() as $p) { $genres[$p->name] = $p->children("sort=random, limit=2"); } for($i = 0; $i <= 1; $i++) { foreach($genres as $genre) { if($genre->eq($i)) { echo $genre->eq($i)->title; } } }
-
I'm seeing a layout issue in the default admin theme where tabs are overlapping the breadcrumbs. The "hasWireTabs" class is not added to the body.
-
Outputting the value of the selected radio button (page field)
Robin S replied to Christophe's topic in API & Templates
The inputfield you choose for your Page field has no impact on how you access the field value using the API. So it's just like any other Page field. The important setting is "Dereference in API as" and this determines whether your field value is a PageArray or a Page object. -
@ottogal An easy solution would be to change... [[audio file="LINK"]] ...to... [[audio file='LINK']] If you want Hanna Code Helper to insert single quotes around attributes I think you'll have to modify the module code. Change line 124 to: $attrs .= " $attrName='$attrValue'"; You can use SimpleXML in your Hanna Code to get the href from the link: $a = new SimpleXMLElement($file); $path = $a['href']->__toString();