-
Posts
16,793 -
Joined
-
Last visited
-
Days Won
1,540
Everything posted by ryan
-
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); }); -
Do you have the LanguageSupportFields module installed? If so, and if the language codes used in the filenames are consistent with the language names in your system, then it's assuming they are language-alternate fields.
- 8 replies
-
- uploads
- file-uploads
-
(and 4 more)
Tagged with:
-
Marco, I think the hook you might be looking for would be TemplateFile::render. The only issue is that this is used by many things, like rendering of partials and such. So you'd probably want to hook into just the instance used by Page::render. Not tested, but I think you could do this by checking for the presence of the $options array (and better yet a property we know would be there--I'll use $options['pageStack']), which would indicate it's the instance you want: public function init() { $this->addHookAfter('TemplateFile::render', $this, 'hookRender'); } public function hookRender(HookEvent $event) { $templateFile = $event->object; $options = $templateFile->options; // checking for $options, which we know is given to page renders // this is to make sure it's not some other use of TemplateFile if(is_array($options) && array_key_exists('pageStack', $options)) { // this is a page render, go ahead and process the output $output = $event->return; $page = $templateFile->page; // I'm assuming you want this $output = yourTwigStuff($output $page); // replace with your Twig code $event->return = $output; } }
-
Please post your modules at: modules.processwire.com
ryan replied to ryan's topic in Module/Plugin Development
Marco, your module is already approved in the directory. Once approved, your updates go in right away. You probably just saw the effect of a 1-day cache on the directory. However, the modules manager should pick it up more quickly than that since it's not on the same cache. Also, you don't have to update the version number manually. The modules directory picks this up automatically once per day by going to GitHub and looking at your module file. No need to edit your module listing unless you already need to change something else. -
Glad you guys like it. Making a little progress with every update. They disable themselves if you get above 100 fields (or 100 templates, but that's less likely). So if you are dealing with that many fields, then you'll not have the drop-down menu option... it would just be too much. It might be that the limit should be lowered to 50 or something, I'm not sure. IMO the fewer scrollbars the better... I'd rather scroll the whole page than something within the page. But I haven't tried the alternative either. These are jQuery UI menus, and I'm not sure yet how to change that (I was trying to earlier). It may be that I just need to come back to it when I've got more time to explore it. But if you see any specific CSS tweaks I can make let me know and I will. Not positive I understand–might need a screenshot that points to exactly what you are talking about. At least, I'm not recognizing where the overlap is here. Theoretically I'm not sure they can be separated (space between them) and still maintain the mouseover state to keep the menus active. I'm not too worried about this, as the error message appear right under the masthead. Also, error messages in this environment are not life-threatening if they somehow miss it. I'll play with it though, as I'm not sure I've even seen the error message in Futura. jQuery UI is adding these button colors when active/click, and I'm not exactly sure how to get around it (I've been pressed for time this week, so haven't pursued these rabbit holes). If you manage to figure it out before I do, please let me know. I get the impression this is coming in from the JS side, since there seems to be a fade-on-click going on here. The yellows and blues that show up in there are not part of the color scheme and I don't know where they are coming from, yet. We probably will expand the scope of this button, but going to keep it simple for the first version. I'd love to see screenshots of these, as I can't see that here (Firefox 24 in OS X). I think the screenshots you attempted to post were probably not JPG/PNG/GIF, given the error message the forum gave you. Please convert them to one of those formats and post. Or if you don't want to convert, just email to me ryan at processwire dot com. Could I see a screenshot? I'm not seeing the jaggies here. Maybe there is something I need to adjust with this particular typeface. Based on what you are saying, I'm guessing the browser is fake-bolding the typeface rather than using the actual bold version of the typeface. Maybe there's something I can do from the CSS side to fix that, but I'd like to get a look at it first. I was trying to find something in-between the old theme's colored field headers and the new theme's non-colored headers... a gradient. But I think those gradients are a failed experiment.
-
Btw, forgot to mention, but these are all committed to the dev branch if anyone wants to try them out.
-
Here's the next iteration of updates which takes into account the comments above. The biggest changes are: Switch to Arimo for the font–thanks to Diogo for the suggestion. This font seems about perfect for our need here. It looks like the license for it wouldn't let us bundle it in the app, so we have to load from googlefonts... but I think that's okay. It'll continue to use Arial for people that are working offline. Got rid of the entire headline, per BartekG's comments above. The headline really doesn't seem necessary (regardless of how big or small it is), and his post made me realize that. The headline text is now just part of the breadcrumb trail. The drop down navigation now includes drilling down to individual fields and templates. ./colors=classic ./colors=modern ./colors=warm ./colors=futura Dropdown example: Not sure I understand–can you clarify which submenu items you are talking about (in the page list maybe)? Anyone else agree? What I was gathering from previous feedback was that folks wanted page list actions that were bigger and less subtle, so making them look a little more like buttons was the intent here. I just want to clarify that this is 1 theme, not 4. The color schemes are merely different SCSS variable files included at the top. Otherwise everything else is the same. There's no maintenance burden here. We are also in a spot where many like the classic color scheme, and it's kind of become our brand. But an equal number (or more) dislike the colors to the point where they see them as childish. So I think we have to answer that by having a variable palette / different options from the start. Good suggestion. I had started to think the title was more important than it was. I looked at several other CMSs to compare (Drupal, Joomla, Concrete5, EE, Craft) and noticed that this new admin theme started the content input before any of those–a good thing for sure. But then I got to WordPress, and noticed their content input is practically at the top of the screen! Granted WordPress uses sidebar navigation rather than header navigation, but it drove home your point for me. It's going to look like you've got a big footer if you have little content on the page and no scrollbar. That's because the <body> background color is the footer color. If you have a lot of content on the page, you will have a very small footer. The actual footer is actually very small / very little padding, but that may not be clear on some screenshots. I'm not sure I agree with this, but it doesn't matter now that the title is gone. Yes the forum may have a black title, but I believe that was a limitation of the IPBoard theming system. Notice the rest of the site (outside the forum) uses the pink titles. So the admin theme was trying to be consistent with that. I'm not against the idea, but since we already support custom icons there, I think it would be too much. Also, we already have visual cues that indicate whether an item is open, so additional icons/cues would be a form of double emphasis. Still, I think in the future, we will probably have default icons for when non are specified (like open and closed folder, triangles or something like that). Thanks–I will look into these. I don't think it should matter. Try hitting reload a couple times to make sure your cache is fresh. Also, your screenshots look to be the old admin theme rather than the one discussed in this thread? Though the icons should work in either, but just want to make sure I know which we're talking about.