Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/01/2018 in all areas

  1. This latest version on the dev branch adds a new site profile to the core, adds useful new functions to our $mail API variable, and makes significant enhancements to our $sanitizer API variable: https://processwire.com/blog/posts/processwire-3.0.105-core-updates/
    9 points
  2. Yes, you can use the code from InputfieldText::getConfigInputfields almost verbatim in a site/ready.php hook, but since that configuration property isn't initialized in InputfieldDatetime and not set in the field's attributes, you have to add that logic too in another hook. A possible place to do that is in Field::getInputfield: <?php namespace ProcessWire; // Add the configuration field: $wire->addHookAfter("InputfieldDatetime::getConfigInputfields", function(HookEvent $event) { $inputfields = $event->return; $required = $inputfields->getChildByName('required'); if($required) { $required->set('columnWidth', 50); /** @var InputfieldCheckbox $field */ $field = wire('modules')->get('InputfieldCheckbox'); $field->attr('name', 'requiredAttr'); $field->label = $event->object->_('Also use HTML5 “required” attribute?'); $field->showIf = "required=1, showIf='', requiredIf=''"; $field->description = $event->object->_('Use only on fields *always* visible to the user.'); $field->icon = 'html5'; $field->columnWidth = 50; if($event->object->requiredAttr) $field->attr('checked', 'checked'); $required->getParent()->insertAfter($field, $required); } }); // This populates the requiredAttr property and sets the HTML attribute // on the InputfieldDatetime instance: $wire->addHookAfter("Field::getInputfield", function(HookEvent $event) { $input = $event->return; if(! $input instanceof InputfieldDatetime) return; $field = $event->object; // Configuration value retrieved from the field's settings in the database: $requiredAttr = $field->requiredAttr; // Probably not necessary but there for consistiency: if($requiredAttr) $input->requiredAttr = $requiredAttr; // This sets the HTML attribute if($input->required && $requiredAttr && !$input->getSetting('showIf') && !$input->getSetting('requiredIf')) { $input->setAttribute('required', 'required'); } });
    3 points
  3. Fieldtype Page IDs is a third party Fieldtype that, simply put, stores Page references as integers (Page IDs). This fieldtype was built as a quick and dirty workaround for Page Reference fields' inability handle self-references due to circular reference issues. A project I've been working on for a while now includes a combination of RepeaterMatrix content blocks and tagging/categorization system that would've resulted in a lot of duplicate pages (and plenty of unnecessary manual work for content editors) had I used built-in Page Reference fields, and thus a new Fieldtype felt like the most sensible approach. Fieldtype Page IDs was designed to be loosely compatible with Page References in order to make conversions between the two feasible, but it is quite limited feature wise: largely due to the fact that stored values are actually just integers with no connection to Pages whatsoever some advanced selectors and related features are not supported, and page values can't be directly accessed configuration settings are limited to the bare essentials (selector string and Inputfield class) only a handful of Inputfields (AsmSelect, Checkboxes, Text) are (currently) supported Anyway, in case you need to store Page IDs (and Page IDs only) and are happy with the limitations mentioned above, feel free to give this Fieldtype a try. It has been working fine for me in one particular project, but hasn't been tested that much, so please tread carefully – and let me know if you run into any issues. GitHub repository: https://github.com/teppokoivula/FieldtypePageIDs Modules directory: https://modules.processwire.com/modules/fieldtype-page-ids/
    2 points
  4. Checkout https://github.com/cytopia/devilbox
    2 points
  5. Yeah, and you can ignore things like "1 star of 5: didn't teach me how to make an facebook clone" in the comments for a 'Learn basic PHP' course. ^ this. I have anxiety which gets much worse without clear direction or when burning out spending hours upon hours on problems without breaks. This course has helped me massively to break up my learning and provided different techniques to use which has made programming fun again and much less stressful for me which is awesome. So glad @FrancisChung recommended this one.
    2 points
  6. If you need this for the backend (result available in frontend too) you can use FieldtypeMarkup for the result. Grab the code from here: https://github.com/kixe/FieldtypeMarkup Create a hook with your formula and place the code in /site/ready.php The result will be populated after saving the page. /** * https://github.com/kixe/FieldtypeMarkup * FieldypeMarkup as concat field with formula * EXAMPLE * */ $wire->addHookAfter('FieldtypeMarkup::formatValue', function($e) { $page = $e->arguments[0]; $field = $e->arguments[1]; // quick exit if ($field->name != 'result') return; if ($page->template != 'calculator') return; $value1 = $page->inputfield1; $value2 = $page->inputfield2; $value3 = $page->inputfield3; $value4 = $pages->get(12345)->inputfield1; // get value from another page $result = $value3 * ($value2 - $value3) / $value4; // formula $e->return = $result; });
    2 points
  7. Thanks, that is really good to know, I will keep it disabled. Done for now. Will try to debug it asap. All the best
    2 points
  8. I'm so glad I wanted to share that with you today. Since November 2017, all of the company's infrastructure is built on ProcessWire. Whether it is the showcase website or the millions of transactions recorded in the database as pages or all the custom modules to interact with the company's data. Just to say that I feel lucky to work all the day with what I love, and when I remember that I was demoralized thinking I had to learn Wordpress or I don't know what, because before ProcessWire I never worked with a CMS and it was becoming vital. Then I stumbled on ProcessWire (hooray!). And now, a new step for me appeared yesterday. I have a trainee for a month. And my task is to teach him how to work with ProcessWire! This make me really proud ! Have a nice day everyone and again, thanks to this community and this software! ?
    1 point
  9. I'm old school in this regard, but I install all the bits I need via homebrew. Here is a pretty nice guide to getting things up and running: https://getgrav.org/blog/macos-sierra-apache-mysql-vhost-apc
    1 point
  10. I thought I'd start this topic because I seem to be recommending certain courses to people repeatedly, so why not share it with the PW community. The topic can be a review or overview of any IT or non IT-related courses you're doing or have done. I'll start off with a course on teaching you how to learn. https://www.coursera.org/learn/learning-how-to-learn I'm halfway through this course and I can already see huge improvements in the way I'm learning and also my approach to learning. I wished I've taken this course when I was a student! The course can be taken free, and all it takes is a couple of hours of your time. If you have kids that are in school, I think this should be compulsory viewing for all children in academia. If you're into self-improvement or learning, then I can't recommend this course highly enough.
    1 point
  11. I always do this: What grinds my gears is when hamburger menus are the only option on desktop sites (just for the sake of looking fancy), so I gotta click on it just to show the available options before I can choose something.
    1 point
  12. @adrian Thanks, I've fixed these. The uikit field with issue is solved by adding the fields (max limit and asm placeholder) after the Required field. @ottogal I wasn't able to find a CSS-only solution to the sticky menu + jump link issue you mentioned. Surely there's one but I've spent too much time on it without success so I let it go instead. I could add JS but that doesn't appeal to me. There's a new productivity tweak for the Delete and Trash pagelist actions: if ctrl key is pressed you can skip the confirmation step. I found it very handy to quickly get rid of test pages. (on the Trash action I mean the one added by AOS that is available for non-superusers). I'll release the update soon.
    1 point
  13. Site Profile Exporter doesn't account for function code in config.php, as it has very limited line parsing capabilities. Basically, it concatenates lines until it encounters a ";" at the end of the line. I don't think there's a quick fix to the exporter, but perhaps setting $config->sessionAllow in the init method of an autoload module might work.
    1 point
  14. Three solutions immediately spring to mind: a) Create different comments fields for each group of pages (downsides: you have to keep other settings in sync and page queries may have to run over both fields) b) If all comments pages are at the same depth (or not too deeply nested) and each has a unique (might also be grand-) parent, you can create a field on those ancestors that holds the admin contact email and use the "field:" syntax in Admin notification email: field:parent.adminemail // or, for grandchildren field:parent.parent.adminemail You could even set multiple sources this way if the adminemail might be either on the parent or the grandparent (just make sure it isn't set on both). The comments field will only use valid emails, so if a parent or grandparent doesn't have the field (or doesn't exist), that entry will be ignored. field:parent.adminemail,field:parent.parent.adminemail c) In some scenarios, you want to send notifications to the user that created the page. In that case, you can use field:createdUser.email The big downside of that approach is that when the creator of the page is no longer available to approve comments, the createdUser field has to be changed or a different email address assigned in their profile settings (and comment notifications might get lost if nobody thinks of that). It should also be possible to populate $field->notificationEmail through a hook, but from the top of my head, I can't name a convenient method to hook into.
    1 point
  15. You miss something ? I'm talking about "Also use HTML5 required attribute". This option is on the Input tab, right to the "Required?" field.
    1 point
  16. Enable debug mode to get the error messages and figure out the problem. in /site/config.php $config->debug = true;
    1 point
  17. neither, content is in database
    1 point
  18. I forgot to update the topic. On the PW 3.0.104 version we get the field labels instead of the field names on "Missing required value", "Restored previous value" and "Page unpublished because field is required" error messages. More info on GitHub.
    1 point
  19. @PWaddict Thanks https://github.com/processwire/processwire/commit/79fa81d8a87a1d026d8f763021b8df191f48a4e0
    1 point
  20. Hi @adrian - After disabled the "RequestInfo panel" on the frontend panels stop receiving the 404 errors and after disabled the "RequestInfo panel" on the backend panels the admin navigation and save is normal, does not delay. Any next steps? Thank you
    1 point
  21. I've changed the type to Date and back to DateTime and now is working as it should. Thanks, hope I can help you in the future.
    1 point
  22. Hi @vmo - thanks for the hard work narrowing it down to repeaters on the homepage. I have no idea why though at this point. I think the one thing you missed in your debugging was unchecking all the debugbar panels. It would be helpful to know if that helps. If it does, try to narrow it down it a particular panel - most likely the RequestInfo panel. If that doesn't help, then sure send me the zip - I might not have time to look for a little while though.
    1 point
  23. Can you describe, how exactly would you use a mapbox map? Why is the default map not enough?
    1 point
  24. Welcome to the forum ? Create a file in site/template called admin.php with this code : <?php namespace ProcessWire; require($config->paths->adminTemplates . 'controller.php');
    1 point
  25. If someone is interested, here is example how to automatically assign icon to file depends on file type. No images or empty HTML tags "<i class="fa..."></i>", only CSS pseudo elements. Link to Codepen Regards.
    1 point
  26. if anybody has ever wondered how secure uniqid is to use (from a security and an uniqueness point of view): https://www.sjoerdlangkemper.nl/2016/06/09/how-phps-uniqid-works/
    1 point
  27. If anyone is interested to know more about REST API, here's a nice tutorial: http://www.restapitutorial.com/
    1 point
  28. Yeah, since then lots of people have gotten used to it. However: We have an in-house UX rule: Never display an icon without text. So yeah, it can't hurt to put "MENU" below the burger.
    1 point
×
×
  • Create New...