-
Posts
321 -
Joined
-
Last visited
-
Days Won
5
Everything posted by justb3a
-
@ank Please have a look at the documentation: Render multiple instances.
-
GithubConnect ProcessWire module to connect a Github OAuth application. Register a new OAuth application Fill in module settings Click the Authorize! link to generate code and access token There are some predefined endpoints to fetch informations about an user or a repository, get a list of repositories belonging to an organization, fetch content of readme or certain file.. I used it to choose a repository from a list and import the content (e.g. readme, description) to the corresponding fields. Visit the Github Repository to get a full overview.
-
FacebookEvents ProcessWire module to get Facebook Page Events using the Graph API. Create an app on Facebook developers website You have to create an app to get appId and appSecret. Those keys are required. Go to Facebook Developers and add a new app. Congrats! Now you can copy your Facebook appId and appSecret. Get your Facebook page ID You can either enter your facebook page ID or the facebook page name. If you enter the Facebook page name, this module will get the page ID for you! Call Module $events = $modules->get('FacebookEvents')->getEvents(); Output Events {% for event in events|reverse %} {% if event.start_time|date('U') > date().timestamp %} <div> {% set dts = modules.get('FacebookEvents').getDates(event) %} <a href="https://www.facebook.com/events/{{event.id}}/" title="Facebook">{{dts.dates}}:</a> {{event.name}} <em>{{dts.times}}</em> </div> {% endif %} {% endfor %
- 28 replies
-
- 21
-
GUID Generator Generate a globally unique identifier (GUID) for Inputfield Text. Usage For each instance of a text field the field settings will be extended. Navigate to Admin > Setup > Fields and edit the desired field. Click on the Input Tab and click on the "Generate GUID" area. It extends downwards and reveals a form to enable automatic GUID generation. After having enabled GUID generation for a text field, edit a page which has a template containing this field. You'll see the field filled with a GUID.
- 4 replies
-
- 14
-
ProcessWire Twig Extensions Allows customizing twig, e.g. add extensions. Dependencies: TemplateEngineFactory TemplateEngineTwig Instructions: After installation go to module settings and enable/disable the required extensions/functions. Includes: Twig Extensions Repository Usage: Adds the following extensions/functions: Debug // only if debug mode is turned on {# dump - dumps information about a template variable #} {{ dump('Hello World!') }} string(12) "Hello World!" Intl {# localizeddate - format dates into a localized string representating the date #} {{ "now"|date_modify("-2 day")|localizeddate('medium', 'none', 'en') }} Mar 8, 2017 {# localizednumber - format numbers into a localized string representating the number #} {{ '50.5555'|localizednumber('decimal', 'default', 'en') }} 50.556 {# localizedcurrency - format a currency value into a localized string #} {{ '50.5555'|localizedcurrency('EUR', 'en') }} €50.56 Text {# truncate - cut off a string after limit is reached #} {{ 'Hello World!'|truncate(5) }} Hello... {# wordwrap - split your text in lines with equal length #} {{ 'Hello World!'|wordwrap(4) }} Hell o Wo rld! Array {# shuffle - randomize an array #} {{ [ 'one', 'two', 'three', 'four' ]|shuffle }} [ 'two', 'three', 'one', 'four' ] Date {# time_diff - difference between two dates #} {% set start = "now"|date_modify("-2 day") %} {% set end = "now"|date_modify("+2 day") %} {{ start|time_diff }} 2 days ago {{ start|time_diff(end) }} 4 days ago
-
The module offers the possibility to add as many fields as you want. Why not using this in-build functionality? Sure, you can store newsletter subscribers under another page or inside of a repeater or in a pagetable or ... There are a lot of options. For my use case it was the easiest solution to store them as a user with a specific role. Users are pages as well! If you want to change this behaviour, you need to rewrite a lot. I wrote a few lines of JavaScript myself to achieve this. This project has no jQuery dependency. Furthermore I do not swap the order, I just need to know, whether the input is empty, focused or filled to be able to set the desired styling. See it in action!
-
I would not recommend doing this. 'allfields' is already declared in the moduleConfig file. If you set it in the module file again, this value will be overwritten and if you render the form all fields are gone. @Arcturus Feel free to optimise the documentation! Fixes and suggestions are very welcome! A lot has been changed since version 0.1.1. I think, this is the page you were looking for, but this is no longer relevant. Because the module now renders the form by itself and no template adaptions are needed any longer. Did you try to render the form (frontend)? If not, please do so. There are some migration functions in the module. If you still want to use this module, please post the input of the column data from table modules where column 'class' equals SimpleContactForm. Furthermore some additional informations would be really good (save messages enabled? fields which should be added, ..).
-
@alexmercenary I found a little bug: The module uses a imaginary field named 'date'. Normally there is no 'date' field (naive assumption, I know) and everything works as expected. But if you create a field named 'date' for something else, the condition matches and the form has one more field than desired. The same counted for a field named 'ip'. I just released a new version 1.0.1. Please try if it's working now. @Tom Walcher The form just validates every field how it is configured in the field settings. If you want to have email validation, set the field type to email. If you want a field to be required, just check the corresponding checkbox in the field settings. Same counts for html5 validation. Hiding the website and date field via CSS is not dirty. The website field is already of type hidden, so you just have to hide the corresponding label. The website field is intentional not hidden. It's a trap for spambot. Have a look at the documentation.
-
@Roych Try this: $scf = $modules->get('SimpleContactForm'); $options = array( 'btnClass' => 'btn btn-blue btn-effect', 'btnText' => 'Send', 'classes' => array( 'item' => 'input-field' ) ); $content .= $scf->render($options); You need to set the placeholder in the field settings, go to Admin > Setup > Fields > Edit Field: xxx > Tab Input > Placeholder Text. It's recommended to hide the label using css (label { display: none; }). People which have to use screen readers will reward you Unfortunately it's not that easy to add the class form-control to every input field. There is no way to set it globally. I would suggest using css to achieve what you want: .input-field input, .input-field textarea, .input-field select { // your styling goes here } Otherwise you have to hook into every render function for every fieldtype you use and pass the class inside the getAttributesString function
-
New Version 1.0.4: @Robin S use label tag if it isn't a multilangual site @jploch, @adrian changed hook InputfieldFile::processInputFile to InputfieldImage::processInputFile
-
@Jon E Just use the comparison inside the foreach loop: foreach ($page->images as $image) { $caption = ''; if ($image->imagetitle) { $caption = "<p class='caption'>{$image->imagetitle}</p>"; } echo "<li><img src='{$image->width(1040)->url}' alt='{$image->description}'>$caption</li>"; } Or if you want to combine multiple parts: you can check every extra field individually and concatenate the caption before outputting it. foreach ($page->images as $image) { $caption = ''; if ($image->imagetitle) $caption .= "<strong>{$image->imagetitle}</strong>"; if ($image->imagetext) $caption .= "<em>{$image->imagetext}</em>"; if ($image->role) $caption .= "<span>{$image->role}</span>"; if ($caption) $caption = "<p class='caption'>$caption</p>"; echo "<li><img src='{$image->width(1040)->url}' alt='{$image->description}'>$caption</li>"; }
-
@FrancisChung Thanks a lot for your feedback and hints. The collaborators of the detection library are working on a new release. As soon as the release has been published, I'll update the module.
-
The subject is translatable. So even if the page is not multi-lingual, you can overwrite the subject this way.
-
@modifiedcontent Actually it's pretty funny you're asking this right now. Some hours ago I opened a feature request regarding this because at the moment it's not possible to swap the order without using regex.
-
Update 2. Wrapping Thanks! Having a look where this wrapper comes from, I found another hook which fits the module needs much better. `<div class="InputfieldImageEdit__additional"></div>` is part of the core (wire/modules/Inputfield/InputfieldImage/InputfieldImage.module). ~/Projects/pw/wire ❯ ag __additional modules/Inputfield/InputfieldImage/InputfieldImage.module 600: <div class='InputfieldImageEdit__additional'>$additional</div> 634: <div class='InputfieldImageEdit__additional'>$additional</div> Having a further look, `$additional` comes from a hookable method which is just perfect for this module $additional = $this->renderAdditionalFields($pagefile, $id, $n); /** * Render any additional fields (for hooks) */ protected function ___renderAdditionalFields($pagefile, $id, $n) { } Using this hook and rewriting a bit, the HTML looks now this way: <div class="ImageData" style="width: 77%;"> <h2 class="InputfieldImageEdit__name"><span contenteditable="true">align-left-2x</span>.png</h2> <span class="InputfieldImageEdit__info">143 bytes, 44×30 </span> <div class="InputfieldImageEdit__errors">..</div> <div class="InputfieldImageEdit__buttons">..</div> <div class="InputfieldImageEdit__core">..</div> <div class="InputfieldImageEdit__additional"> <div class="InputfieldImageEdit__additional--custom">..</div> <div class="InputfieldImageEdit__additional--title">..</div> <div class="InputfieldImageEdit__additional--foo">..</div> <div class="InputfieldImageEdit__additional--orientation">..</div> <div class="InputfieldImageEdit__additional--link">..</div> </div> <input class="InputfieldFileSort" type="text" name="sort_images_34c8cc73419393a219a5cb218ebcc4b2" value="0"> <input class="InputfieldFileReplace" type="hidden" name="replace_images_34c8cc73419393a219a5cb218ebcc4b2"> <input class="InputfieldFileRename" type="hidden" name="rename_images_34c8cc73419393a219a5cb218ebcc4b2"> </div>
-
@Robin S Thanks for your feedback! 1. Label vs. Strong I'm totally with you, semantically it should be a label but I had a reason why I wrapped it inside a strong tag: If you have a multilingual installation, the label of the extra field is no longer the title of the field, it'll look something like this (core behaviour, I tried to stand as close as possible): <div class="InputfieldImageEdit__core"> <div class="hasLangTabs langTabsContainer"> <div class="langTabs ui-tabs ui-widget ui-widget-content ui-corner-all"> <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist"> ... <li>...</li> ... </ul> <div class="InputfieldFileDescription LanguageSupport ui-tabs-panel ui-widget-content ui-corner-bottom" data-language="1010" id="langTab_images_34c8cc73419393a219a5cb218ebcc4b2__1010" aria-labelledby="ui-id-13" role="tabpanel" aria-expanded="true" aria-hidden="false"> <label for="description_images_34c8cc73419393a219a5cb218ebcc4b2" class="detail LanguageSupportLabel">English</label> <input type="text" name="description_images_34c8cc73419393a219a5cb218ebcc4b2" id="description_images_34c8cc73419393a219a5cb218ebcc4b2" value=""> </div> <div class="InputfieldFileDescription LanguageSupport ui-tabs-panel ui-widget-content ui-corner-bottom" data-language="1012" id="langTab_images_34c8cc73419393a219a5cb218ebcc4b2__1012" aria-labelledby="ui-id-14" role="tabpanel" aria-expanded="false" aria-hidden="true" style="display: none;"> <label for="description1012_images_34c8cc73419393a219a5cb218ebcc4b2" class="detail LanguageSupportLabel">German</label> <input type="text" name="description1012_images_34c8cc73419393a219a5cb218ebcc4b2" id="description1012_images_34c8cc73419393a219a5cb218ebcc4b2" value=""> </div> </div> </div> </div> For each language you'll have a label and input field wrapped inside a div tag. The label is the currently selected language. If you haven't only the description field, it's important to mark the field with a title. I chose the `<strong>` tag because it looked the best comparing with headlines. I didn't want to add additional css or inline styles. This is how it would look using h1-h4. The `h1` looks most similar to the label, but I don't want to use `h1`'s because semantically it doesn't make any sense at all. One opportunity would be to use a `label` element if it isn't a multilingual site and a `strong` tag if it is one. What do you think? 2. Wrapping You're right, I'll fix it. 3. type="text" vs textarea At the moment as soon as a textformatter is applied, `type="text"` will be changed to `textarea`. The idea behind this was that some textformatter like "NewLineToBreak" or "NewLineToListItem" doesn't make that much sense applied to an one liner input element. This could be an additional setting, but I'm not quite sure if it's necessary. I tried to keep it as simple as possible
-
@Tanky Sorry, I have not the time at the moment to try this myself. But this is more a general topic, please try to use the forum search, I know there are a lot of topics which cover how to add an image via api. If you want to have an "archive"/Feed of all images/posts, you should consider to decouple the process of saving images from displaying it on the webpage. I would set up a cronjob or something like this which "asks" repeatedly at certain time intervals whether there are new posts. Then you could add a new Page / Page-Table-Item / Repeater-Item (it's up to you how to save it) containing the image and all the desired data (location, comments, ..) as well as the id (`$media['id'|`). Simply check if you already have an item with that id. You could also check whether `$media['created_time']` is greater than the last inserted item. Or even better: the endpoint supports additional parameters which could be implemented as well: MAX_ID Return media earlier than this max_id. MIN_ID Return media later than this min_id. Using MIN_ID you should be able to only receive new posts/images.
-
SystemUpdater #12 Error, PW incompatible with mysql 5.7.x ?
justb3a replied to felic's topic in General Support
@gebeer I changed it in the `my.cnf` file directly but it only occurred (as well^^) in my local environment. -
@dab It's not that good idea to change something inside a third-party module (or, even worse, in the core). If you update the module, all your changes get lost. I would suggest translating the values – which will be inserted – with 'spam' and 'time'. You could also translate "Sorry, but your message didn't pass our %s test. Please try another %s." with "Sorry, but your message didn't pass our spam test. Please try another time.". Therefore I made them translatable.
-
@dab Could you please pull the latest version from branch develop? I fixed this already some time ago but haven't released it yet.
-
hi @Tanky you could add an image field to your page and save the image there. Try something like the following: $page->of(false); $page->images->add($media['images']['standard_resolution']['url']); $page->save("images");
-
-
You're completely right. Thanks for the hint, I'll change it. `core/Sanitizer.php` function textarea: /** * Sanitize input string as multi-line text without no HTML tags * * - This sanitizer is useful for user-submitted text from a plain-text `<textarea>` field, * or any other kind of string value that might have multiple-lines. * * - Don't use this sanitizer for values where you want to allow HTML (like rich text fields). * For those values you should instead use the `$sanitizer->purify()` method. [...] */
-
@mel47 You can only apply one textformatter for a field. You're right, I'm using sanitizer textarea to sanitize the input values. And the default option – which will be provided to the textarea() sanitizer – is: // strip markup tags 'stripTags' => true, Therefore all tags are gone. I updated the sanitizer usage and set this option to `false`. Please update the module and try again!
-
@Matt_P If you use the `getRecentMedia()` endpoint you should be able to access the location inside the foreach loop. Have a look at the instagram api, expand the response and there you'll see an example response containing all data which will be returned including a location entry. "location": { "latitude": 37.778720183610183, "longitude": -122.3962783813477, "id": "520640", "street_address": "", "name": "Le Truc" } Code example (not tested): <?php $feed = $modules->get('InstagramFeed')->getRecentMedia(); ?> <div class="instagram"> <?php foreach ($feed as $media): ?> // check if location is not `null` <?php if ($location = $media['location']): ?> Location: <?= $location['name'] ?> <?php endif; ?> <?php endforeach; ?> </div>