Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/10/2021 in all areas

  1. I have just found this module and once again am astonished at the scope of interest and productivity of @adrian! Whatever I am looking for years after I started using PW he already has a module for written when I was just messing around ? This one is the great example. But the module is not as perfect as it could be. There is an issue (see above) that does not allow it to work as desired. I just added my thumbs up for the issue on github that makes the enhancement of the module (and custom hooks too) possible. Bumping this thread, so those of us working with multi-language sites could give their thumbs too to move the issue forward (it was waiting for us for a long time)) P.S. Multi-language support is one of the PW's selling points, so I feel proud making any step to improvement in this field)
    2 points
  2. I wanted to view the contents of a JSON post in a web hook from an external application. In this instance the source application was Stripe posting event info at irregular intervals to a PW page URL. The process had to be unobtrusive. Solution was to send an email to myself. The web hook page template contained: // create a PW mail object using whatever method works for you $mail = wire()->modules('WireMailSmtp'); // Retrieve the request's body and parse it as JSON $stripe_input = @file_get_contents("php://input"); $event_json = json_decode($stripe_input); try { $body = "<pre>" . var_export($event_json, true) . "</pre>"; $mail->to('my@emailaddress.com'); $mail->from('from@emailaddress.com'); $mail->subject('test event_json'); $mail->bodyHTML($body); $mail->send(); } catch (\Exception $e) { $error = "Email not sent: " . $e->getMessage(); $mail->log($error); } Resulting email body contains nicely formatted code, eg: stdClass::__set_state(array( 'id' => 'evt_XXXXXXXXXXXXXXXX', 'object' => 'event', 'api_version' => '2016-07-06', 'created' => 1476900798, 'data' => stdClass::__set_state(array( 'object' => stdClass::__set_state(array( 'id' => 'sub_XXXXXXXXXXXXXXXX', 'object' => 'subscription', 'application_fee_percent' => NULL, 'cancel_at_period_end' => false, 'canceled_at' => NULL, 'created' => 1476900796, 'current_period_end' => 1508436796, 'current_period_start' => 1476900796, 'customer' => 'cus_XXXXXXXXXXXXXXXX', 'discount' => NULL, 'ended_at' => NULL, 'livemode' => true, 'metadata' => stdClass::__set_state(array( )), 'plan' => stdClass::__set_state(array( 'id' => 'annual', 'object' => 'plan', 'amount' => 8000, 'created' => 1474521586, 'currency' => 'usd', 'interval' => 'year', 'interval_count' => 1, 'livemode' => true, 'metadata' => stdClass::__set_state(array( )), 'name' => 'Annual', 'statement_descriptor' => NULL, 'trial_period_days' => NULL, )), 'quantity' => 1, 'start' => 1476900796, 'status' => 'active', 'tax_percent' => NULL, 'trial_end' => NULL, 'trial_start' => NULL, )), )), 'livemode' => true, 'pending_webhooks' => 1, 'request' => 'req_XXXXXXXXXXXXXXXX', 'type' => 'customer.subscription.created', ))
    1 point
  3. Hi everyone, Here's a new module that lets you control whether multi-language support is enabled at the page / branch level, rather than only per template. http://modules.processwire.com/modules/restrict-multi-language-branch/ https://github.com/adrianbj/RestrictMultiLanguageBranch This is ideal for a site with repeated branches using the same templates where only some need to be multi-language. I think it is confusing to provide multiple language inputs for fields when they are not required - it just bloats the admin interface for site editors. I am hoping to expand this module to allow selection of which languages are supported per page/branch, but I am waiting on @ryan's response to this request: https://github.com/processwire/processwire-requests/issues/54 - to me this would be even more powerful if you have a situation where certain branches need some languages and other branches need different languages. The module config settings shows a summary of the restrictions you have implemented, eg: This shows that we have started with the home page which disables multi-language on itself and all its children/grandchildren (because "This Page Only" is "False". Next we have the /report-cards/ page multi-language enabled, but no inheritance (because "This Page Only" is "True"). The only branch below this to have multi-language enabled is Guanabara Bay and all it's children etc will also be enabled. All other report card branches will be disabled because they will inherit directly from the config settings default status. The Settings tab for each page gives you three options: Inherit, Enabled, Disabled. The screenshots give you an idea of how the Inherit option works and the information it provides based on the status it is inheriting and from where. My goal for this site was to just enable multi-language support for the Guanabara Bay report card branch of the tree, as well as the home page and the /report-cards/ parent. All other branches have multi-language support disabled which makes content entry much cleaner. Hope you guys find a good use for it and I'll be sure to update with the ability to define which languages are available on which pages/branches if Ryan comes up with a core solution for changing the returned $languages. Please let me know if you have any problems / suggestions.
    1 point
  4. 1 point
  5. That is a great and question. I do not know any European companion compared to Vimeo or YouTube. Most services are based on AWS or Akamai CDN. Vimeo ships with excellent customisation options and a great UI. To be honest, I have not used it so far. Usually I am hosting video files myself and preload the mp4 and webM files. In terms of playback performance and bandwidth, I have never experienced major slowness. Even with higher bitrates and scrubbing through the video, the playback is great on most recent devices. Todays smartphones are soo powerful. Using crippled shared servers could lead to slow progressive downloads, though. If you are looking for a full featured SasS video compression, Vimeo's and YouTube pricing and customisations are unbeatable. Otherwise you have to spend some time on tweaking the video compression before uploading. I guess this is not the answer you were looking for. ?
    1 point
  6. Thanks @kixe - I didn't have a need for repeaters when I wrote this module, but it's certainly a good idea to support them. I have gone ahead and updated the module based on your idea and it now works for repeaters as well. Thanks!
    1 point
  7. @adrian Hi Adrian, I quickly tried your module and find it very useful. But does it work with repeater fields? I couldn't get it working ... I played a bit around and found another simple solution. config.php /** * array of pages or page trees having multilanguage disabled in the edit screen * */ $config->singleLanguagePages = array(11973 => 0, 12334 => 0); ready.php /** * disable multilanguage in Page Edit for specified pages or page trees * define array of single language pages in $config * where the key is the page id and the value defines if the page acts as a tree parent or only for a single page */ $wire->addHookBefore('ProcessPageEdit::execute', function($e) { $page = $e->object->getPage(); $slps = $this->wire('config')->singleLanguagePages; // exit if doesn't match if (empty($slps)) return; $parentIDs = array_intersect($page->parents()->prepend($page)->each('id'), array_keys($slps)); if (empty($parentIDs)) return; foreach ($parentIDs as $parentID) { if ($page->id == $parentID) break; // page matches itself if ($slps[$parentID]) break; // page is part of a single language tree return; } // page is set as a single language page $page->template->noLang = 1; // we want repeater fields single language as well foreach ($page->fields as $f) { if ($f->type instanceof FieldtypeRepeater == false) continue; $this->wire('templates')->get(FieldtypeRepeater::templateNamePrefix . $f->name)->noLang = 1; } });
    1 point
  8. Love it! This just saved my arse… ? oh man, because of gems like this I love PW so much!
    1 point
  9. Thank you @adrian for so useful module. It would be super great to have opportunity to disable default language for some branches/pages
    1 point
  10. Hey guys, Just about to do my first ML work and feeling like a bit of a noob I have a site with several branches with the same templates and similar content but each one will have different language requirements - some will be English only, but the first ML one will be both English and Portuguese. Future branches will probably be English and Spanish and then who knows what others might be. I am wondering if there is a way to hide unnecessary languages from the branches that don't need them. I will need this to work for page names, titles, and all other fields. I will be making use of the ML features of the Profields Table field too, if that has any impact on how to make this work. Thanks for any ideas - maybe it's very easy and I just didn't RTFM properly
    1 point
  11. Thinking this through I think I would like to add a page field (checkboxes) on the parent page of each branch that is linked to the list of installed languages so I can specify which language field inputs should be available to all child pages in this branch. Now the catch is finding the hook that determines the languages to list. This may need to work with both multi-language fields and language alternate fields, although I am not sure about this yet. I haven't scoured thoroughly yet, but does anyone know the best hook for this?
    1 point
  12. Matthew, the main "gotcha" with adding files to newly created pages is that the page needs to exist in the DB before files can be added to it. So if you are creating a new page, you'll just want to have a $page->save(); somewhere before you add the file to it, and another $page->save(); sometime after you add the file to it.
    1 point
×
×
  • Create New...