-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
I have deleted this module from the directory, but you should consider removing the link from your first post and explain to users what the alternative is.
-
I have deleted this module from the directory, but you should consider removing the link from your first post and explain to users what the alternative is.
-
Hey guys - sorry for the migrator issues here. I know that Macrura did a migration of pages with a page field that linked to users (I think that is correct). As I mention a couple of posts above, I think this is because of the way I have migrator grab and recreate the content of page fields on the destination site. Usually this isn't a big deal, but I need to change some behavior so it doesn't mess things up when linking to system pages like in this case. It's on my list to sort out!
-
Pete - I think the biggest issue with doing a check like you describe is if the video url field is changed to a different video. In that case you'd want the image to be changed. I think it would be manageable though - check if the existing image has a filename consistent with a video thumb and if it is, then replace it, but if not leave it because it was manually uploaded. But given that the default PW behavior would be to overwrite the existing image in the field, perhaps your manual thumbnail field is a better idea? It might even be nice to set a field dependency on the automatic thumb field such that it's only visible if the manual one is blank? However that is a different issue to respecting the maxFiles setting. I can't find much about it, but there is reference to it in soma's post here: https://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/?p=30979 Should the PW core ensure this setting is respected when uploading via the API, or should it be up to us to check? Anyone have any thoughts on this?
-
Just a thought on this. It looks like this will result in URLs like: mysite.com/documents/mydocument/ that will directly display a PDF. Correct? Maybe it's just me, but I always like to know when I am about to open up a PDF - it gives me the option to save instead, or open in a new tab, or decide not to open because I am on mobile don't want to wait for a potentially huge PDF file to open. Maybe this is becoming less of an issue now that browsers are directly rendering PDFs themselves, or sites are using mozilla's pdf.js etc. Anyway, just my two cents worth PS, given that you are using a file field, shouldn't: $file= $page->pdf; be: $file= $page->pdf->url;
-
Update "How-To Install or Uninstall Modules"
adrian replied to Richard Jedlička's topic in Getting Started
Ok, I have updated that page with the suggested content. I fixed a few typos, added a git clone section, and also a "How to Upgrade" section. I'd appreciate a look over for any mistakes or possible improvements. Thanks again Richard for putting this together. -
Hey Pete, Glad you like it! Do you mean that you have more than one video link embedded on a page? Is that why it is trying to insert more than one thumbnail? Or is it because you are using "All Available", rather than "First Available"? I don't think I actually realized that the the API ignores the max number of images setting. I am happy to fix this, but would like to know if you are dealing with more than one video, or the "All Available" setting. I am also curious what you think would be the preferred behavior - I guess if I replicate the admin behavior, adding a new image would replace the last one, but that seems rather ugly if you have checked "All Available" because it will attempt to add each one, but each time deleting the last one for the latest in the options. Same would go for more than one video link in a scanned field - each image would get added, only to be later replaced. Any thoughts on what the best logic might be here?
-
Hey Marty, I am not a Formbuilder user so I don't know all the ins and outs, but I just set up a form and tested with CustomUploadNames and the page was created and the filename was changed as it should have been. I have a feeling because CUN and FB both have so many config options, it might be just the combination you have that is causing problems. Perhaps you could export the form for me to test and also take a screenshot of your CUN rule so I can duplicate. I am sure we can get it sorted out for you.
-
Not sure your exact scenario, but I have made use of: $this->addHookBefore('InputfieldPassword::processInput', $this, 'removeRequired'); public function removeRequired(HookEvent $event) { $event->object->required = false; //hack to remove required status on password field } From memory it's not possible to set the status of the password field directly to not required. I know this is not the same as disabled, but now you should be able to disable or hide it and should work as expected I think. One thing to keep in mind, the system password field is actually named "pass", not "password" like you have there.
-
I might be missing what you are actually after, but do you know about using something like this for the selector value for a page field: parent=page.otherpagefield That allows for ajax population of one select based on the selected value of the otherpagefield
-
Replace: $pageid = $this->sanitizer->selectorValue($this->input->get->id); $page = $this->pages->get($pageid); with: $page = $event->arguments[0]; Remember the id get variable won't be available on the front-end via the API. EDIT: Actually, better yet, don't use $page at all, use $p instead - you don't want to overwrite the current $page with the one being saved.
- 23 replies
-
- 2
-
- page
- after saving
-
(and 1 more)
Tagged with:
-
You can click "Edit this Module" and then save it again and it will update version number, readme text etc. You can also wait about 24 hours and it will update automatically.
- 17 replies
-
- 3
-
- profile
- responsive
-
(and 1 more)
Tagged with:
-
His avatar is one scary looking Romeo
-
The hook should work whether it's in the admin or via the API, but if the code that sets up the hook is in a module that isn't autoloaded or called via the API then it won't work. So it would really help to see exactly how you have things set up.
- 23 replies
-
- page
- after saving
-
(and 1 more)
Tagged with:
-
How to configure CKEditor(textarea field) to enable Color toolbar?
adrian replied to KangLing's topic in Getting Started
Yes, or maybe this one: http://ckeditor.com/addon/colorbutton -
Not using SVGs on your site? You should be, and you should be sanitizing them: http://mods.pw/9U
-
Call to undefined method DirectoryIterator::getExtension()
adrian replied to Outcydaz's topic in General Support
PW requires 5.3.8 http://processwire.com/about/requirements/ -
Hey Joss - I think the issue is more about refreshing the modules cache in general which probably happens when you update another module. That error with PageEditFieldPermissionConfig is actually a bit painful - if you upgraded PW to latest dev before upgrading the module it becomes quite difficult to get rid of that error because you can't actually upgrade the module to the latest version that fixes it. You might need to manually uninstall it, then reinstall - at least that was my experience.
-
Until the core issue is fixed properly, simply wrap that entire function in: if (!function_exists('PageEditFieldPermissionConfig')) { That will get things working again for you.
-
Some threads worth reading if you haven't already seen them: https://processwire.com/talk/topic/5777-default-value-for-fields-in-admin/ https://processwire.com/talk/topic/1593-how-can-i-specify-default-value-for-certain-input-field/ https://processwire.com/talk/topic/394-default-field-value/
-
I have always read that DOMDocument was much quicker than regexes for parsing HTML, and it's certainly easier to build and read. Sounds like you know what you're doing though - sorry if I came across too strong - hard to know someone's experience level initially. Anyway, keep up the good work!
-
Hi rot - thanks for this. Might I make a small suggestion. You might find it simpler to use DomDocument - something like this: $p = $pages->get(1); $dom = new DOMDocument(); @$dom->loadHTML( mb_convert_encoding($p->body, 'HTML-ENTITIES', "UTF-8") ); $dom->preserveWhiteSpace = false; $images = $dom->getElementsByTagName('img'); foreach ($images as $image) { // the existing classes already on the images $existing_classes = $image->getAttribute('class'); // the class we're adding $new_class = ' this-will-be-the-class'; // the existing classes plus the new class $class_names_to_add = $existing_classes . $new_class; // add class to the parent of the img node - <a> $image->parentNode->setAttribute('class', $class_names_to_add); } In this example I am applying it to the body field of the homepage, but you get the idea
-
Hey kongondo, thanks for the suggestion - already on my list of things to do I would like to be able support Fieldset tabs as well as custom ones created via modules, like Nic's Page References Tab - I can see I am going to need more than one technique here Was there any particular custom tab setup you were interested in being able to hide? Just good to get an idea of all the possible options. Thanks!
-
Just wanted to follow up to say that today's PW core updates fix the issue with SVG files with no dimensions specified. There is also a new SVG validator/sanitizer that you should consider installing: http://modules.processwire.com/modules/file-validator-svg-sanitizer/ Please let me know if this solves all the issues with dimensionless / responsive (Illustrator's term, not mine) SVG images.