Jump to content

Search the Community

Showing results for tags 'Api'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi, I have a small module I created that copies across field content from one page to multiple other pages. I just added a repeater field and while it copies across to the other pages it has caused timeout/memory issues with PHP. I think this is because of the multiple fields within the repeater (title, text caption, image) each being copied multiple times. I thought one way to help would be to not copy images across as they're not needed in the other pages. However I'm unable to figure out how to copy a repeater field excluding one field within the repeater itself. This is my current code: // Inline gallery 1 if(count($page->article_inline_gallery_1)) { $translation->of(false); $translation->article_inline_gallery_1->removeAll(); $gallery = $page->article_inline_gallery_1; foreach($gallery as $item) { $translation->article_inline_gallery_1->import($item); $translation->save("article_inline_gallery_1"); } } At the point that each repeater imported as a whole ->import($item) could anyone help to exclude one of the fields within the repeater?
  2. I have a web page where all templates have Norwegian (default language) and English (secondary language, ID 1036). Many of my pages have been imported using the API, and so I used a method from How to set language = active via API? to set the secondary language active. Now I want to output a list of pages where the secondary language is inactive. I have tried the following without luck: $pages->find("template=basic-page, status1036=0") But this gives an error: Field does not exist: status1036 Is there another way that makes this possible? Additional information: basic-page was just an example, I should have been more clear from the beginning. I have multiple templates and a totalt of 170 000 pages to check.
  3. I have been trying everthing about images. I have read the documentation about the field itself, some threads, a tutorial, and the cheatsheet. I am creating an events portal, and I have a template called Event, with an Image field for the poster of the event. In the homepage I am listing the events, and I am able to output the Tiitle and the Date (with is another field), but I am not able to output the poster. How can I do this? I am missing something? If you need any other information, just tell me. Thanks in advance!
  4. Hi everybody, I am working on a project where I have a search form with an input field, that should search over a lot of PW fields (text and pagefields). What I am trying to get is something like this: $pages->find("title|body|sidebar|summary|intro|keywords|country.title%='word1 word2 word3'"); The problem is now the search input. If I insert two words (word1 word2) it should look into every field, just like: $pages->find("title|body|sidebar|summary|intro|keywords|country.title%=word1, title|body|sidebar|summary|intro|keywords|country.title%=word2"); So far so good. but there is the possibility to add up a lot of words, and then MySQL is at its join limit and quits with an error. Is there a possibility to prevent this? I even limit the words for the input but this is not good. On the more complex site I tried the fieldtype "cache". So far so good, but now there is the problem with pagefields that are searched too like "country.title". This is not working, as I read in the forum, and in the database there is only the ID of the pagefield in question. On a normal search by selector I would definitely use that, but here it is not the point, because the input is a word, not an ID. Example: $pages->find("cached_fields_in_fieldtype_cache|country.title%=word1, cached_fields_in_fieldtype_cache|country.title%=word2"); I know the second example is not the best for this kind of search. It is easy to put an OR selector with the values together, but an AND selector (third example) is limited to the MySQL functionality. I want to is a search ability like some might know from Joomla (no I am not a Joomla fan or developer, but the client is ). In Joomla there are the three possibilities to search from an input text: any word (same as selector operator "~=" ?) all words (same as selector operator "*=" or "%=" ?) exact wording (same as selector operator "*=" ?) There is no limitation of words in the search input, so I am wondering how this is working. So, what I got at the end are two options for the selector: 1: $pages->find("cached_fields_in_fieldtype_cache|country.title*='wor d1 wo rd2 word3'"); // mostly no results at all if word is only part of the complete word. Word length limitation to at least 4 characters The first option here is only working if the word is complete. If the search is "wor" and not "word1" then I get only result on one word input, but do I add another word to it, it gets no result. 2: $pages->find("cached_fields_in_fieldtype_cache|country.title%=word1, cached_fields_in_fieldtype_cache|country.title%=word2, cached_fields_in_fieldtype_cache|country.title%=word3, ..."); // result limited by word count Now I am almost on the model to remodel the search and limit it only to some parameters (as it should be...), but this would question the the clients "wish" for the search. Another point is to extend the selector with more pagefields ("cached_fields_in_fieldtype_cache|country.title|method.title|town.title" etc.) that can not be put into the cache fieldtype. So the MySQL limit is coming back again... is it even possible to store the subfield of a pagefield in the cache field? Does anyone know how it would be possible to get that kind of search running? Maybe a direct MySQL search? filter results by adding part or complete words (to find the one and only result) search with multiple words (no MySQL error because of join limitation -> I am already cutting off too many words) Thanks for your help!
  5. Hi, I'm trying to write a bash script that automates our release procedures. 1 of the things I've written is a php module that clears the Procache settings and resets. The php module runs if I call it from a browser but if I call it from a bash script I get a connection refused error. Error: Exception: SQLSTATE[HY000] [2002] Connection refused (in /Users/FrancisChung/Sites/Develop/wire/core/ProcessWire.php line 293) This error message was shown because: you are using the command line API Error has been logged. Assuming this is a security precaution, I was wondering if there is a different way around this? Perhaps write a container php module that launches the bash scripts instead?
  6. Hi Guys This hook works fine. $this->addHookAfter('Pages::saveReady', $this, 'hookIndexingBefore'); protected function hookIndexingBefore( HookEvent $event ) { $page = $event->arguments("page"); if(!$page->template->hasField("index")) return; // no index field in this page/template if($page->isNew() || $page->isTrash() || $page->indexSaveFlag) return; $language = $this->wire("user")->language; // save user lang $page->index = ''; foreach($this->wire("languages") as $lang) { $this->wire("user")->language = $lang; // change user lang wire('pages')->setOutputFormatting(true); $content = $page->render(); // render page and get the content wire('pages')->setOutputFormatting(false); if($content) $content = $this->parseContent($content); //remove html, new lines etc... $page->index .= $content; } $page->indexSaveFlag = true; // in case it get's saved again (not case with Pages::saveReady) $this->wire("user")->language = $language; // restore user language } But when I try to save a page per api I get an Internal Server Error 500. When I replace "$page->render();" with "" inside the hook, it doesn't cause a internal server error anymore. $page->save(); //causes internal server error now
  7. Is there any way (module?) to execute basic api commands from inside the PW admin? For example, say I wanted to do a (one-off) something like set a field value to "this is a default value" for all pages with a specified template; What I do presently is temporarily add some code to a template file and then browse to a page which uses that template; Then once the commands are run I delete the code from the template..... $p = $pages->get("template=test"); $p->of(false); $p->set( 'fieldx', 'this is a default value' ); $p->save(); The PW API is so good, so coupling it with such a cumbersome method to achieve a simple pages update seems dodgy. Am I missing something? I find myself doing this type of thing quite often, so how does a real PW geek (as opposed to a wannabe PW geek ;-)) achieve the above?
  8. Hi guys, I've just discovered Processwire and I'd like to build my new project on it. It seems PW is the tool I was looking for. It's my first post and I guess many others are coming A few words about me : I live in France, I used to be a php dev (looong time ago), became a MySQL DBA during a few years and now a little less hands-on (except on that project). Speaking of the project, it's the complete rewrite of a game related to motorcycle races (you have to guess the podium in different categories). I have players who sign up, record a prediction for the next Grand Prix, get a ranking according to the precision of their prediction (vs real results). They have a profile page, etc. The frontend is based on data which is updated each Grand Prix (through some pure croned php scripts). The website sends automatically newsletters according to the date (vs the races calendar) and the same goes for the email which warns players their score was updated. It runs for years now. My goal is to reach thousands of players on this new version. I'm not anxious about speed here, I guess it will be ok, and I'll probably be a future client of ProCache and ProdevTools (yes I saw the coupon code :). That also will be my way to support the work which has been done here. Actually I'm rewriting the whole stuff (based on pure Php) and I will host more races next year (more categories, more players, more... everything). I'm interested in PW because I'm looking a modern way to rebuild my website without reinvent the wheel : using all the built-in stuff from PW (routing system, session/authentication, and all what the other modules can offer !). OK, enough for the project Although I've been through some different tutorials and read tons of thread on this forum for the last 3 days... I didn't yet make my mind on the solution to choose : "pure" SQL queries or use the API/pages. As I said before, I'm a DBA, I'm ok with queries and I've already wrote most of them. Actually, I see how to import my tables into the PW's database, so I can directly connect to my old tables (you call that custom tables I think) with the db handler which is passed to every page. I see how to create a template, I see how to choose the ouput strategy, but I have some difficulties to see how to add content to each page. I don't know if I need all this actually. I've read this very useful thread : https://processwire.com/talk/topic/18-how-do-i-import-lots-of-data-into-pages/ from @ryan, who answered a very good question from @jbroussia Technically speaking I understand the stuff but perhaps it's overkill for me. I'm looking for the easiest/quickest solution (I have so many things to code before launch :-/). According to you, can I survive without importing all my data in PW fields by using this way : $result = $db->query("SELECT id, name, data FROM some_table"); while($row = $result->fetch_array()) print_r($row); As I said the DB is updated frequently (each Grand Prix) and each player's score is updated in the same time, that goes for the different categories, well a lot of stuff is moving at each Grand Prix. According to me it should work with template + page using that template but without filling the fields... ? Moreover I'm afraid of losing some PW functionnalities here : Accross my readings I've picked up some quotes which I haven't completely understood, perhaps you can help me on that. - "If you want to present your data at unique URLs, then pages is the way to go.... " (from https://processwire.com/talk/topic/5325-database-table-versus-pages/) - "While it's there and ready for you to use, it's always preferable (not to mention easier and safer) to use ProcessWire's API for accessing any of it's data." - "If you went the pages route, you can also harness the extended power of templates, e.g. using templates to control page access..." (from https://processwire.com/talk/topic/17-functionsmethods-to-access-the-db/ -> I understand it's "easier" to use the API, but why is it "safer" than my own SQL queries ? I still have to sanitize myself any user entries in both case for example no ? -> Won't I be able to control page access if I'm not using the API ? I didn't dig into control access yet, please forgive me if the question is a nonsense. -> What about the uniqueness of URL that is mentionned in my first link ? Well, I think that's enough for a first post and thanks in advance for your answers.
  9. I cannot manage to delete this page upon uninstallation of a Process module I have that was working previously. I thought the only difference would be that I added `namespace ProcessWire;` to the start of the module PHP, however I've tried without it and still I get It is an admin page. Right now I have $get = 'template=admin, parent!=trash, name=importall, include=all'; $gp = wire('pages')->get($get); if($gp->id) { wire('log')->save($log, "$gp->id".get_class($gp).__NAMESPACE__); $gp->delete(); if(!wire('pages')->get($get)->id) wire('log')->save($log, "Deleted Imports page."); } previously $gp = $this->pages->get('template=admin, parent!=trash, name=importall'); if($gp->id) { $this->pages->delete($gp, true); $this->log->save($log, "Uninstalled ". get_class()); } Why will it no longer delete? I can't even do so by the GUI.
  10. As the title states, I am trying to process a form and save the form's data as a new page. I have looked at Soma's post, but it seems (as least to me), that it tackles submission forms etc. I know what I am trying to do is very very similar. The Form: <form role="form" method="post" action="./" > <div class="form-group"> <label for="code">Enter 4-Digit Code:</label> <input type="code" class="form-control" id="code"> </div> <button type="submit" name="submit" class="btn btn-default">Submit</button> </form> And the processing: if($input->post->submit) { $code = Trim(stripslashes($_POST['code'])); $p = new Page(); $p->setOutputFormatting(false); $p->template = 'singular'; // example template $p->parent = wire('pages')->get('/'); // example parent $p->name = $code; // example name $p->title = "Test Title"; $p->save(); echo "page ID {$p->id} created!<br>"; } else { // output contact form echo "Negative Ghost Rider"; } ?> I have been scratching my head as to why this doesn't seem to work for about an hour. I am sure I must be missing something, or trying to go about this the wrong way. The form seems like it submits, but there is no page added to the backend.
  11. Did it get removed completely? http://modules.processwire.com/modules/service-pages/
  12. Hello everyone, greetings from Belo Horizonte / Brazil. I'm on the process of converting a site from WP to Processwire, this one: http://www.ricardo-vargas.com I needed a simple Flickr Gallery and tried to find a way to create album pages via API and download the images to the local filesystem (just a few, for cache purposes). So I created yesterday a simple script that, given an album ID, download its data using cURL and save the photos to a temp dir. After that, add them to a new page under /pictures/ Feel free to comment on the code, I'm a designer, not a developer, and this is my first time using PW API You can grab it on GitHub: https://github.com/sjardim/processwire-simple-flickr-album Instructions Download the files Put the templates/get_flickr_sets.php on your templates/ folder. Create a page on Processwire using this template Create or edit the page where the albums will be created. In my case it was /pictures/ IMPORTANT: Add guest edit/create permissions to this /pictures/ page, otherwise the script won't work Create a temp dir on your server and set it on the previous file Get a Flickr API on https://www.flickr.com/services/apps/create/ Add one or more Flickr album IDs on get_flickr_sets.php Open the page using the get_flickr_sets.php template on your browser <?php include "../lib/curl.class.php"; // You will need to get a Flick API Key // Get it here: https://www.flickr.com/services/apps/create/ // Load it on the file below include "../lib/flickr_album_utils.php"; function download_file($url) { // Save the image on local filesystem (You need to create this folder first) // On your server it can be /var/www/name_of_folder/ $tempdir = '/Users/XXX/phpFlickrCache/'; $fp = $tempdir . basename(parse_url($url, PHP_URL_PATH)); // if we already downloaded the images for some reason (like testing), just return it if (!file_exists($fp)) { $fh = fopen($fp, 'wb'); $curl = curl_init($url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); curl_setopt($curl, CURLOPT_FILE, $fh); curl_exec($curl); curl_close($curl); fclose($fh); } return $fp; } // Get some public album id to test $albumID = ["72157636029541784"]; //$albumID = ["72157649576832173", "72157633296236495", "72157644132091553", "72157636029541784"]; // Load ProcessWire API $pages = wire('pages')->get('/pictures/'); /* -------------------------- GET ALBUM INFO FROM FLICKR -------------------------- */ foreach($albumID as $album) { // Via GET, return album and its photos info $album = fa_get_album($album); // create a new post $page = new Page(); $page->template = 'picture_album'; $page->parent = $pages; // disable page output formatting $page->of(false); $page->name = wire('sanitizer')->pageName($album['title'], true); $page->flickr_album_id = $album['id']; $page->title = $album['title']; $page->generic_integer = $album['total']; //total number of photos on flickr album – OPTIONAL //My client albums descriptions have two phrases, one in English and other in Portuguese // let's separate then by the period, but sometimes there is no period, so the PT description will remain blank $description = explode('.', $album['description']); $en = $languages->get("default"); $page->summary->setLanguageValue($en, $description[0]); $pt = $languages->get("portuguese"); $page->summary->setLanguageValue($pt, $description[1]); $page->set("status$pt", 1); //activate portuguese page $page->save(); // We need to save the page BEFORE adding images /* ------------------------------------ DOWNLOAD AND SAVE IMAGES FROM FLICKR ------------------------------------ */ $images = array(); $i=1; $maxImages = 11; foreach($album["all_images"] as $f) { //we do not want all the photos, just a little bit if ($i >= $maxImages) break; // mount the flickr photo url using its attributes $photo_url = 'https://farm'.$f["farm"].'.staticflickr.com/'.$f["server"].'/'.$f["id"].'_'.$f["secret"].'_b.jpg'; // download and return the image file in the filesystem $images[$album['id']][$i] = download_file($photo_url); // add images to the current page in the loop $page->images->add($images[$album['id']][$i]); $i++; } $page->save(); echo "<p>Created page for album: <strong>".$album['title']. "</strong></p>"; // Tip: Now, after we saved the images to ProcessWire /site/assets/files/, we can safely delete them from the $tempdir if needed } print "<pre>"; print_r($images); print "</pre>"; Admin Screenshot
  13. I just noticed when I try to do this in the ready.php that it can not retrieve the page. This works perfectly in the init. But since I need my languages I'm forced placing it in the ready. I'm just trying to get the child from a page. $pages->get("name=settings")->child(); Var_dumping that gives me a Nullpage. (and yes the name is correct since it does work in init.php but doesn't in ready.php) So I have no idea what I'm doing wrong, I was guessing maybe it's a bug?
  14. I have a PageTable field that is updated via a custom module. Pages are updated by deleting them then re-adding but crucially need be re-added in the same order in the PageTable field. If I re-add pages, they go to the bottom of the field (it's a manual drag n drop setting). Is there a way to re-add where the page was previously? Or at the very least I need to maintain the first page in the field. It has a checkbox ticked if it's first so the re-added page could use that to test whether it needs to go first. I just don't know how to set the order of pages in a PageTable field via the api. Any help here much appreciated.
  15. I can't find out this "bug" $query = 'template=shop_item,item_category=1101'; $items = $pages->findMany($query); echo count($items); if user is logged in. The result is 1, But if not the result is 0.
  16. Hi there, I'm trying to implement a hidden stats page to store various counters and I'm using this article as a basis for my PHP Code I've created a stats page based on a stats template, and the page is set to unpublished with no other attributes. What have I overlooked if the following code returns a Nullpage ? $stats = wire(pages)->get("/stats"); I can "get" a homepage without any issue for reference.
  17. Hi all. I'm creating module and it needs to create some actions in admin panel to work correct. So it would be great if somebody tell my how to do some things below using api (___install() method): create fields put fields to template Thanks
  18. I have a module that creates a bunch of fields and none of the Options type are saving their values. The options I have set appear in the page editor, however when I go to edit any of these fields the textarea where the options are supposed to be specified is blank. $f = new Field(); $f->set("name", "iu_do")->set("label","Action(s)"); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set('inputfieldClass', 'InputfieldCheckboxes')->save(); $f->options = [0 => "Import", 1 => "Update"]; $f->set("required",1)->set("optionColumns",1); $f->set("tags","-impupd")->set("columnWidth",50)->save(); How do I do this right? Thank you.
  19. I am looking to hide a googlemap api key from general source code. The first suggestions were to use an environmental variable, then because that doesn't hide the info to then encrypt it. Others have suggested using a config file. (Can I put an array in the config file?) What do you guys do to hide API keys from general source code like this?
  20. Hi, I am writing a custom module that grabs external data via API calls. I would like to store this data as a temporary cache that gets refreshed every X minutes (API calls run in interval) What would be my options in terms of managing this cached data and where to store them? Thanks Rudy
  21. I've updated my site's PW version from PW 2.6.x to the latest version. I've updated manually by copying the wire directory and overwriting index.php and .htaccess. When I try and load up the page I'm getting the following error. Error: Call to undefined function Site\wire() (line 5 of /Users/FrancisChung/Sites/Develop/site/templates/php/const/Const.php) My Const.php looks like : namespace Site; require_once(__DIR__."/../../../../index.php"); Define(SITE_DIR, wire(config)->paths->templates); Define(IMG_DIR , wire(config)->urls->templates."img/"); Define(IMG_SQDIR, wire(config)->urls->templates."img/square/"); Define(IMG_SDIR, wire(config)->urls->templates."img/small/"); Define(IMG_MDIR, wire(config)->urls->templates."img/medium/"); Define(IMG_LDIR, wire(config)->urls->templates."img/large/"); Define(IMG_PATH, SITE_DIR."img/"); Define(IMG_SQPATH, SITE_DIR."img/square/"); I'm guessing the wire(config) calls are failing because of the new Namespace implementation? Is there a way of fixing this without having to change every wire(config) or other wire(fnXXX) calls?
  22. This is in my module's install() function: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_template")->set("label", "Template"); $f->option_table = "templates"; $f->option_value = "id"; $f->option_label = "name"; //$f->filter('id not in (2,3,4,5)'); $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); // set to select from template's allowed parents $f->type = wire('modules')->get('FieldtypePage'); $f->set("name", "iu_parent")->set("label", "Parent"); $f->set("derefAsPage",1)->set("required",1); $f->set("findPagesSelector","template!=admin,hasParent!=2"); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->inputfieldClass = 'InputfieldCheckboxes'; $f->set("name", "iu_actions")->set("label", "Action(s)"); $f->options = ["import" => "Import", "update" => "Update"]; $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $options = array(); foreach(wire('fields') as $opt) { $options["{$opt->name}"] = "{$opt->title}"; } $f->options = $options; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Oddly every time I install the module the second field `iu_parent` says it still needs configuring, without fail; I have to go to the field editor and just save it as it is one time. Anyway the real field in question here is the last, i.e., `iu_uid`. That method of adding options is entirely ineffective, sadly; it adds none at all. What I need is for it to dynamically populate with the fields in the previously selected template's fieldgroup on saveReady. This is possible with page fields, to dynamically populate options based on another field's value. Alternatively I can set up `iu_uid` like so: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Then I would just need for a hook to filter the options to correspond with the `iu_template` value. Any pro tips/guidance to spare on this subject?
  23. I have a module that creates a repeater field on install: $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetTabOpen'); $f->set("name", "iu_maptab")->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $r = new Field(); $rName = "iu_map"; $r->type = wire('modules')->get('FieldtypeRepeater'); $r->set("name", $rName)->set("label", "Map Fields"); $r->set("tags", "impupd")->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_field")->set("label", "Template Field"); $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeText'); $f->set("name", "iu_value")->set("label", "Source Value Selector"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeCheckbox'); $f->set("name", "iu_static")->set("label", "Use Static Value"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetClose'); $f->set("name", "iu_maptab_close");//->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $rfg = new Fieldgroup(); $rfg->name = "repeater_{$rName}"; $rFields = ["iu_field", "iu_value", "iu_static"]; foreach($rFields as $rf) { $rfg->append($this->fields->get($rf)); } $rfg->save(); $rt = new Template(); $rt->name = "repeater_$rName"; $rt->flags = 8; $rt->noChildren = 1; $rt->noParents = 1; $rt->noGlobal = 1; $rt->slashUrls = 1; $rt->fieldgroup = $rfg; $rt->save(); $rpg = "for-field-{$r->id}"; $r->parent_id = $this->pages->get("name=$rpg")->id; $r->template_id = $rt->id; $r->repeaterReadyItems = 3; foreach($rfields as $rf) { $r->repeaterFields = $this->fields->get($rf); } $r->save(); Now I can't uninstall it, on account of a field being used in the fieldgroup created for the repeater -- can't delete that field because it's in the fieldgroup which I am trying and failing to delete: $rf = wire('fields')->get('iu_map'); $rt = wire('templates')->get('repeater_iu_map'); $rfg = $rt->fieldgroup; if($rf) { wire('fields')->delete($rf); wire('fieldgroups')->delete($rfg); wire('templates')->delete($rt); } foreach(wire('fields')->find("tags*=impupd") as $f) { wire('fields')->delete($f); } Please help this is such a bother. The fieldgroup should be deleted before attempting to delete the field itself.
  24. I need this field in a template, and then another select field which is dynamically populated with field names/references to those present in the previously chosen template for options. Any tips?
×
×
  • Create New...