-
Posts
17,231 -
Joined
-
Days Won
1,697
Everything posted by ryan
-
$form = $forms->get("reconocimientos"); echo $form->render(); $form->get("reconocimientos")->addHookAfter("processInput", null, 'hookEmail'); A couple things to mention about the above code (quoted from above). You are adding a hook after the render(). You would need to add the hook before the render. That's because processInput is triggered from render(). Secondly is that you are hooking the wrong thing, as I don't think there is a 'processInput' method on $form (since it's not an InputfieldForm). What you'd want to do instead would be this (in your form-builder.inc file): wire()->addHookAfter('FormBuilderProcessor::processInput', null, 'hookProcessInput'); function hookProcessInput(HookEvent $e) { $processor = $e->object; if($processor->formName != 'reconocimientos') return; $inputfields = $processor->getInputfieldsForm(); // your code here. }
-
Bug: Adding image with no alignment adds invalid class to image
ryan replied to Lance O.'s topic in General Support
I'm not able to duplicate this one. Anyone else seeing it? I've tried on both PW 2.3.0 stable and 2.3.5 dev, with both TinyMCE and CKEditor. "No Alignment" is not intended to be a CSS class. It sounds like somehow the option label is ending up as the CSS class in your case rather than the option value. -
Diogo, would the Pages::added hook be what you are looking for?
-
Being able to link to hidden pages is important. Often times we make pages hidden specifically because we'd rather make our own contextual links in text rather than have them in the site's navigation. As for unpublished pages, there are situations where we may be working on a group of pages that get published together, so not sure it's good to prevent linking. I think the best thing to do here is inform the client what it means when a page has a strikethrough. If it's a strong need there, I can show you how to accomplish it now with a hook. I don't know if it's a bug in CKEditor or not, but I couldn't find another way around it. DIVs aren't acceptable replacements for <p> tags, so that's why I put in that fix. Hackish I know, but solved the issue here. I'm always on the hunt for a better solution though.
-
Thanks for testing it out. 2.3.5 is the current dev branch version (soon to be 2.3.6)
-
I'm guessing it doesn't have anything to do with the spiders, other than that they tend to make a lot of requests in a short period of time. It sounds like your web host is limiting the number of DB connections to a number that's not appropriate for your site. It may be helpful for you to enable template caching (or better yet ProCache) to reduce the amount of time spent on each request. Or ask them to increase the resources available to your site (which may be futile if it's a large/budget host).
-
Hooking wakeupValue called multiple times?
ryan replied to Soma's topic in Module/Plugin Development
I'm not positive on this one and not at a place where I can check it just yet, but LanguageSupport does repeat several function calls for each language, and this may be one of them. Though not immediately sure why it would be (I would think it would be FieldtypeTextarea's wakupValue that gets called 3 times, not FieldtypeTextareaLanguage). It's also possibly the result of something to do with a repeater? If you add another language, is it then called 4 times? -
I'm confused because you can't change the default language per-se. You can change what you consider to be the default language, but it still has to have the name "default". In fact, ProcessWire doesn't (or isn't supposed to) let you change the name of the default language at all.
-
Sorry, I should have clarified that the text-shadow should be added to the body tag... body { text-shadow: 0 0 1px transparent; /* google font pixelation fix */ }
-
For you guys where Arimo is looking bad, can you try adding this to your /site/templates-admin/styles/main-[colors].css file and see if this fixes it? I found this in HTML Kickstart's stylesheet, so was thinking maybe Joshua already figured this one out for us: text-shadow: 0 0 1px transparent; /* google font pixelation fix */ Horst–thanks, I'll check out Muli too.
-
I'm not aware of any bugs here, and I do these kinds of API replacement of images daily. But you might try and see if using the dev branch makes any difference here. Also it would be good to know of any modules you have installed in case anything is hooking into any of this.
-
Accessing PageTitleLanguage when bootstrapped
ryan replied to ralberts's topic in Multi-Language Support
You might want to move this into a PW template file (the exact code, minus the require_once at the top). This would ensure things are output formatted and you can take advantage of PW determining the language for you and such. Though the way you are doing it is just fine, but since you are bootstrapping PW output formatting is not enabled by default. You can enable output formatting for your $affiliate pages, so that you are dealing with formatted values. In your case, that would mean $title would be a string rather than an object. $affiliate->of(true); You may also want to add a header before outputting your JSON: header("Content-Type: application/json"); -
Peter, have a look at /wire/core/Sanitizer.php and the selectorValue() function in there, as I think it'll answer your questions better than I can here. But to attempt an answer here, these are the lines where the character replacement occurs, which shows which characters it replaces. For the most part, these are characters that might be used as operators. Technically, it doesn't need to replace them anywhere other than at the beginning or end of the string, but it currently replaces them no matter where they are (it's on my todo list to optimize that): $value = str_replace(array('*', '~', '`', '$', '^', '+', '|', '<', '>', '!', '='), ' ', $value); $value = str_replace(array("\r", "\n", "#", "%"), ' ', $value); using $sanitizer->selectorValue() is going to be valuable primarily when dealing with user input. If you are dealing with API-level stuff that doesn't involve user input, then it should be just fine to sanitize yourself rather than using selectorValue. I would just quote your value and make sure it doesn't already have quotes in it: if(strpos($field_value_search, '"') !== false) throw new WireException("Sorry value can't have quotes"); Quote the value in your selector. Since the value is already surrounded in quotes, PHP requires you to escape the embedded quotes: $check_field_dupe_id = $pages->get("$field_name=\"$field_value_search\", include=hidden, check_access=0" )->id; In cases where you are using $sanitizer->selectorValue() and it surrounds the value with quotes, then you don't need to worry about escaping embedded quotes as they are already present in the string. Meaning, you can do this: $cleanValue = $sanitizer->selectorValue($dirtyValue); $pages->get("field_name=$cleanValue");
-
I'm not aware of such a module, but the existing ProcessPageEditLink might be a good starting point. Note that if using with TinyMCE, you also have to write a custom TinyMCE javascript plugin to connect with it. For instance, the "pwlink" plugin that comes with PW's install of TinyMCE is what connects to ProcessPageEditLink.
- 1 reply
-
- field selector
- url
-
(and 2 more)
Tagged with:
-
images inserted by editor to open in lightbox - best coding?
ryan replied to Joe's topic in General Support
You can copy the entire ProcessPageEditImageSelect module to your own directory in /site/modules/, but make sure you rename it to something of your own, like ProcessPageEditImageSelectCustom (or whatever you want). You'll have to rename not only the files, but the class name in the module file as well. Modify the module as you'd like, then in your admin: 1. Install your new module from the Modules menu. 2. Go to Pages > Admin > Page > Image Select. Edit that page, and select our new module as the "process" rather than ProcessPageEditImageSelect. -
They will be presented in whatever order is used by the parent you are pulling them from. I'm guessing in your case that the parent page used for your selectable options is configured to sort the children by date. You could change this by configuring your Page reference field to use a selector string rather than a parent. This should do what you need: parent=/path/to/your/parent/, sort=name
-
Unfortunately once you start on a PHP 5.3+ you can't migrate passwords back to a PHP 5.2 server. PHP 5.2 did not support blowfish, so it has no way to validate the password. The only solution is to do as you did, and reset your password.
-
Welcome Faisal, good to have you here, and thanks for the nice intro!
-
Davo, what you are doing there looks about right to me. Populating the $p->map->address should trigger the Google Geocoder into action. Just make sure you have a $p->save(); somewhere in there so that the coordinates get saved. I wonder why this is the case? I wonder if it's jQuery or google maps that's polluting the other (I'm guessing Google Maps). Can it be resolved by using jQuery() rather than $(), or is it something beyond this?
-
I used to use Transmit and honestly never had the syncing working quite right with it. Though this was years ago, and Transmit is pretty much the most popular FTP app in OS X. I would be surprised if it were still buggy in that respect. I personally use Yummy FTP now, but I generally try to avoid using any FTP for transferring files unless it's the only option. I have a strong preference for rsync.
-
I think you may be asking for something broader in scope than can be answered in a forum post. There are any number of ways to do it, but I would try and find a good jQuery table plugin (perhaps ajax driven) that provides some of what you already need and take it from there. Retrieving the data to display in your table from ProcessWire will be the easy part.
-
Nobody has added it to the modules page. This is up to the author of the module as to whether they want to add it to the modules directory or not. I also wanted to mention that the dev branch of PW has a "locked" option for inputs, which may produce a similar result. See the screenshot:
-
It seems like you might be asking the same question that's already been answered? Either that or I don't understand the question. I'll step back and assume that maybe you aren't talking about page relations. A best practice would be to make sure you aren't duplicating any data. Meaning, pull the data from the source. For instance, if you wanted to retrieve the first image from the homepage, regardless of what page you were actually on in your site, then retrieve the homepage and pull the value from it. Same goes for anything else. Every page and its data is accessible to you from the API. $homepage = $pages->get('/'); $image = $homepage->images->first();
-
You could retrieve the errors from the Inputfield, clear them out, and then replace with your own: $errors = $inputfield->getErrors(true); // true=clear the errors out // $errors is a plain PHP array of error messages... // ...if you want to iterate it or do anything with it $inputfield->error('Your custom error message');
-
setMarkup() does not work for Radio buttons (InputfieldRadios)
ryan replied to Valery's topic in General Support
The setMarkup() is just for adjusting the markup of Inputfield lists, not the markup of individual Inputfields. That markup is not currently changeable programatically. Your best bet would be to either: 1) the clean way would be to make a copy of InputfieldRadios => InputfieldRadiosCustom, install as a new module and make it produce the markup you want. 2) the quick n' dirty way would be to replace the <li>'s with <div>'s by hooking after InputfieldRadios::render wire()->addHookAfter('InputfieldRadios::render', function(HookEvent $e) { $e->return = str_replace( array('<li ', '</li>'), array('<div ', '</div>'), $e->return); });