Search the Community
Showing results for tags 'select options field'.
-
so i made some options in t he field type, and i want to check if selected title is that output this is my sample code if($media->r_soc == 'facebook') { $soc = 'facebook'; } elseif($media->r_soc == 'twitter') { $soc = 'twitter'; } i just basically want to check if the user in CMS selected option facebokk and then outpit it into variable which is later outputted into fa icon, oh and also this is all in repeat field foreach($ikonky as $media) { so thats why its $media, but as of now it outputs blank state, not sure why, it doesnt outpit anything none of the check goes throught these are options i have in the field 1=facebook 2=twitter 3=instagram 4=youtube 5=github 6=linkedin
-
I have an array of bilingual pages. These pages have a body. If the body is filled, it's in the array. So the array is different in english than in german. Criteria is the body. I want to change that though and use a SelectOptions field as criteria instead. That field would be a multiple value checkbox SelectOptions field with values as follows. 1=English 2=Deutsch Now I want to check one or two of these options for each page via API. Something like: foreach ($suckers as $s) { // :D if (user()->language->title == 'Deutsch') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "2"; } elseif ($s->cast_language == "1") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } if (user()->language->title == 'English') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "1"; } elseif ($s->cast_language == "2") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } } But I think that's nonsense, still cannot tell from the documentation how to approach this. The issue is, the array depends on the user's current language, so in order to use this function to set the values right I need to run it once in German and once in English. But at the second run it will overwrite the values of the first run. Don't know how to add to the array of selected options. Thanks for help!
-
Hello everyone, I am struggling a little bit with combining Isotope with Processswire. The functions themselves work nicely and I managed to give the sortable items their categories via a page field and now I also want to make the sort order manageable with a field instead of on the actual site, so the client can easily set the way they want their stuff ordered. I am using a Select Options Field and am giving the sortable elements an extra class with that, and that does actually work, looking like this: <h2 class="headline_article<?php if ($home->sortPreviews->value == "headline"){echo " is-checked";}?>"><?php echo $article->headline; ?></h2> The only problem I have is that for the headline I want the sort order to be ascending, but for the date I want it to be descending, and as far as I know with my 1 month of coding knowledge I can only set it as either or in the grid defining javascript. Which now basically looks like this: var $grid = $('.grid').isotope({ getSortData: { selectedCategory: '.is-checked', } }); $grid.isotope({ sortBy: 'selectedCategory', sortAscending: { selectedCategory: false, } }); is it possible to either check if the item that now has the class "is-checked" also has the class "date" and then to set the sort order to descending in that case while in any other it should be ascending? Or if not is there maybe a different way to approach the whole idea? Any help is much appreciated!
- 1 reply
-
- isotope
- select options field
-
(and 1 more)
Tagged with: