-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
161
Everything posted by kongondo
-
A couple of things have derailed me some, so I cannot promise this. Beta testing will also take a bit of time, sorry.
-
Your IDE didn't flag this up?
-
@besrwordt, Do you have a current Media Manager subscription? makeBlankItem() is implemented in the latest Media Manager (version 012, soon coming out of beta). However, you can still import from one MM field to another. A MM field behaves like PageArrays (WireArrays). A Media Manager field stores only two pieces of data; the (page) ID of the media being referenced and the media type (1=audio; 2=document; 3=image; 4=video; 3x=image variation). There's two ways you can go about exporting/importing from one field to the other. The second way is easiest if you need to import everything from one field to another, no questions asked. The first method allows fine control, e.g. if you want to skip certain media types. In the examples below, media_export is the Media Manager field with the media you want to copy over/merge with a second Media Manager field. media_import is the second Media Manager field into which media is being imported/copied over. Method One: Loop through each media in the Media Manager field you are exporting from // page with mm field we are importing into (media_import) $p = $pages->get(1234); // page with mm field we are exporting from (media_export) foreach ($page->media_export as $m ) { // @note: here you can skip media you don't want to export // instance of new MediaManager() $mm = new MediaManager(); // populate the MediaManager object properties with required data (media id and type) $mm->id = $m->id; $mm->type = $m->type; // import/add the media to the 2nd mm field (media_import) $p->media_import->add($mm); } // output formatting of $p->of(false); // save only the media manager field (page with import mm field) $p->save('media_import'); // revert output formatting back on $p->of(true); Method Two: Import everything at once // page with mm field we are importing into (media_import) $p = $pages->get(1234); // import all the media in the 1st mm field (media_export) into the 2nd mm field (media_import) $p->media_import->import($page->media_export); // output formatting of $p->of(false); // save only the media manager field (page with import mm field) $p->save('media_import'); // revert output formatting back on $p->of(true); Note that all WireArray behaviour apply. For instance, you might want to first experiment in cases where your 2nd Media Manager field (media_import) already has some media which may or may not be present in the first Media Manager field.
-
Flatland Monokai by gerane
- 246 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
That's strange. I've never seen this. I could do some testing but I'm finding it a bit hard to follow your setup (the project template, 1041, etc). If I could see an illustration of how everything connects plus your selector string as well as any code or setup you use for the page-reference field, that would help. Seeing what Tracy returns as a final selector would also be helpful. -
Modules are not different from PHP classes. To change the properties of MyModule class from within MyOtherModule class, you can either: Make MyOtherModule class extend MyModule. It will thus inherit MyModule's public and protected properties and methods Make the properties firstName and lastName configurable by passing them as parameters/arguments in MyModule's constructor method.
-
How to use selectors include=hidden only with specific template?
kongondo replied to Hurme's topic in API & Templates
I can confirm it doesn't work if an 'include' statement (unpublished, hidden or all) is added. I'm not sure if this is by design or it is a bug. -
How to use selectors include=hidden only with specific template?
kongondo replied to Hurme's topic in API & Templates
OR-groups is your answer. Have a look here: https://processwire.com/docs/selectors/#or-groups -
Hi @besrwordt, Welcome to the forums. Currently, no. I'll look into this. What versions of MM and PW are you using?
-
Thanks for the examples! It was already clear from @teppo's post since you said that was exactly what you meant ?. A few more examples don't hurt though, so thanks. Hmm. Personally, I'll have to think about this more. The idea is very clear but I'll want to think about the implications first.
-
I noticed this as well and was going to comment about it :-). You are right it currently lacks consistency. When viewing API variables, the sidebar is in context. It should be the same when viewing Functions API. I also agree with all the other points you've raised @Tom. @ryan, Could you please consider reverting the API reference to the single column it used to be? Maybe it's just me, but I am finding the two-column layout confusing. My suggestion would be: This link: https://processwire.com/api/ref/ leads to a one-column layout page with short summaries of the topics (lack of a better word) in the API reference. Something like: API Reference API Variables These are Lorem ipsum dolor sit amet, consectetur adipiscing elit. An est aliquid, quod te sua sponte delectet? Duo Reges: constructio interrete. Videsne quam sit magna dissensio? Quis est tam dissimile homini. An potest, inquit ille, quicquam esse suavius quam nihil dolere? At hoc in eo M. Si quicquam extra virtutem habeatur in bonis. Et quidem iure fortasse, sed tamen non gravissimum est testimonium multitudinis. Read More... (linking to ..api/ref/api-variables/) Core Classes Quippe: habes enim a rhetoribus; At multis se probavit. Quid, quod homines infima fortuna, nulla spe rerum gerendarum, opifices denique delectantur historia? Unum est sine dolore esse, alterum cum voluptate. Quodsi ipsam honestatem undique pertectam atque absolutam. Itaque eos id agere, ut a se dolores, morbos, debilitates repellant. Read More...(linking to ..api/ref/core-classes/) Functions Tantum dico, magis fuisse vestrum agere Epicuri diem natalem, quam illius testamento cavere ut ageretur. Homines optimi non intellegunt totam rationem everti, si ita res se habeat. His similes sunt omnes, qui virtuti student levantur vitiis, levantur erroribus, nisi forte censes Ti. Read More...(linking to ..api/ref/functions/) Etc.. When I land on the API Variables page, all I would see are API Variables stuff, with the contextual sidebar menu showing API Variables stuff only ($page, $pages, etc). When I land on the Functions page, I would see the Functions stuff with a contextual sidebar showing Functions stuff only. Verbosity I agree with previous comments about verbosity on this page but since this is a getting started section, maybe it's not too bad. And it's one of those things; some like verbosity, others don't. I know and appreciate it took a lot of time to write this up. Writing documentation is not easy. However, if you take some time away from the writing, step aside and revisit it later, you will see stuff like these jump at you: Under the section You are always accessing the same exact thing. The word 'Regardless' is used 5 times :-). What I am saying is that there is room to make this documentation a bit tighter and to the point without losing the audience to curtness/brevity. That aside, please consider removing this line: I think it is leading to more questions without providing answers. For a getting started section, I would expect to at least see a link to 'come across more'. I would ask, what are those more? Why are there more? Where would I come across them? Other Minor Issues I'm not sure how the 'pages' plural and 'page' (singular) phrases will work when the site gets translated to other languages. Other languages will not be able to state: plural and singular in the same way. I suggest instead, to highlight or bold the words. I think it is pretty clear that pages and page are different. There were some other things but I forget. I may revisit this post or post another later ?.
-
Access $modules variable from within _init.php
kongondo replied to Stefanowitsch's topic in General Support
You are getting hit by a variables scope issue. You cannot use global variables like $modules directly inside a function. Instead, use this (there are other variants - see the new docs here) wire('modules'); -
I think let's stick to convention. ProcessWire has always used installed ?. For me, it means the module is installed in the ProcessWire system. A module that is present on the disk but not yet installed just means it is not yet part of the ProcessWire system. Of course. My point was not that they should not be there, but they should probably be in their own tab, just to make things obvious ?. ??
-
Looking good! Is it possible to also filter by installed/not installed? Would you consider a separate tab for core modules? Most of core modules will be already installed and probably most are required by ProcessWire so should not be uninstalled, hence, we don't really need to see them on the main screen. This would help focus on third-party modules, our primary concern.
-
I understand the need to conserve resources, smaller file sizes, etc. What I'm not getting is whether this is for the benefit of the ProcessWire server or this module. If the latter, then the question is how many times does the average site need to install modules? Usually, is it not a one-off thing? You set up a site, install needed modules and that's it? Or, is it the case that we want to be regularly browsing for new modules from within our sites? Sorry, I'm having a very slow week and I am perhaps missing the plot ?.
-
No authentication whatsoever? Surely you don't mean 'free-for -all' editing? I'm sure I'm missing something. Please explain.
-
I've been debating whether to do markdown docs (Docsify or variants) hosted on GitHub for my pro modules but the private repos thing always held me back. Does anyone know whether a repo can be private but its related wiki or GitHub pages is public?
-
?. I'm really tempted to move my private repos from Bitbucket. I got nothing against them; just want code to live in one place. For now though, I'll stay with BB.
-
What? What's the catch ??
-
$out = ''; if(count($story->galleria)) { $firstImage = $story->galleria->first(); $out = "<img src='{$firstImage->url}' alt='{$firstImage->description}'>"; } else { // no images; do something else } echo $out;
-
No. Say you want to create a page. You click on create page, choose template , blah blah. The original thinking was then to display very short code snippets (the show you how to do it bit), with each step, i.e. assign the template, assign title, (save) create the page, etc. However, I now realise there's need to have this and a live code editor where you can play with the code (like in Tracy).
-
OT, but though to mention it here. I have been working on a site profile (still in alpha >>> it's been ages! other things got in the way) inspired by the Electron API Demos app that will do this and more. Essentially, it teaches you to use the API. On install, you get nothing but the 'blank profile'. You choose a topic and It teaches how to accomplish what is covered in that topic, e.g. the AP to create/edit/delete fields, templates, pages, etc.
-
That's correct. Full multi-lingual support has been on my todo list for a long time. Hopefully I'll get some time soon to look into it. Thanks for sharing your workaround with others.
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
@psy, Thanks for the info. I have not been able to replicate this. I've used your example HTML strings and it works just fine. Page Edit renders fine. I even tried with invalid/broken HTML and nothing breaks; it works OK. I missed this earlier. What do you mean 'format it'? I'm wondering if your string is maybe returning invalid HTML that somewhere trips the browser? Just guessing. Other than that, RuntimeMarkup's CSS and JS files are blank; they never return anything. I need to remove them actually as they don't do anything. If all else fails, I'm happy to have a look around your install if that's possible. -
Module Module: RuntimeMarkup Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
@psy, I have moved your topic here since this is the support forum of the module ?. Apologies, I have not had the time to finish up on some new features and merger the dev version into master. I don't understand this. Please clarify: What function is this? Can we see the code please Where are you calling the function? Directly in RuntimeMarkup field settings or it is in a file and you are calling it using wireRenderFile() or $files? Errors in dev console? Can we see the output from the FormBuilder entry