Jump to content

mn-martin

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

1,452 profile views

mn-martin's Achievements

Jr. Member

Jr. Member (3/6)

1

Reputation

1

Community Answers

  1. I'm having the exact same problem. The intention to use a custom template for the job is to have additional fields together with the custom process. I also just copied / required the original admin.php template file. I thought it would make sense but it seems like this is not an option? Can you please shed some light on this @ryan
  2. Hello @Jonathan Dart, is this plugin still maintained? I don't see support for ProcessWire 3.x?
  3. Has anyone actually got that to work? It keeps throwing following error for me: <b>Fatal error</b>: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='A.S.', value='', selector: 'A.S.' (in ~/Documents/PW-Testumgebung/wire/core/Selectors.php line 357) Here's the exact selector I'm using: $selector = [ [ 'field' => 'title', 'value' => 'A.S.', 'operator' => '^=', 'group' => 'foo', ], [ 'field' => 'title', 'value' => 'Adam', 'operator' => '^=', 'group' => 'foo', ], ]; Edit: I think that was a bad example. At least the operator should be different. What seems to be working thought is the following code: $selector = [ [ 'title^=' => 'A.S.', 'title=' => 'Adam Blenk' ] ]; Unfortunately now I'm forced to use associative arrays. I prefer the regular array syntax a lot. Is there any other way? Please enlight us @ryan
  4. Hello Yannick Albert, thank you for the suggestions. I'm sure these will work for the frontend. Unfortunately i see the same results as with my other attempts. The backend will just return error messages telling me that the files do not exist. (Screenshot)
  5. Hello, today I've tried the following: Use .htaccess to rewrite the url conditionally if an image file was not found. Rewrite target was http://www.this-is-the-live-system.com/site/assets/files/$1 I guess that would work out great. Unfortunately Processwire checks to see if the file exists and outputs an error message in the Page Editor. An option to disable this check would be great. (Similar to $config->debugIf = '::1'; or something) It would be great being able to just use the live database locally without broken images all over the place. I guess this might be a simple good enough solution for most use cases.
  6. Just implemented a very simple fieldgroup inheritance module. I thought it may be helpful to others. Any insights on issues that may occur using this are very welcome if you find some. protected $relations = [ 'foo' /* parent fieldgroup name */ => [ [ 'template_name' => 'bar', 'auto_remove_fields' => true, ] ] ]; public function init() { $this->addHookBefore('Fieldgroups::save', $this, 'syncFields'); } public function syncFields( HookEvent $event ) { $fieldgroup = $event->arguments[0]; if ( ! array_key_exists($fieldgroup->name, $this->relations)) return; $processTemplate = $this->modules->get('ProcessTemplate'); $importFieldgroup = new ReflectionMethod('ProcessTemplate', 'importFieldgroup'); $importFieldgroup->setAccessible(true); $removedFields = $fieldgroup->removedFields; foreach ($this->relations[$fieldgroup->name] as $relation) { $template = $this->templates->get($relation['template_name']); $importFieldgroup->invoke($processTemplate, $fieldgroup, $template); if ($removedFields && $relation['auto_remove_fields']) { foreach ($removedFields->getArray() as $fieldName) { $this->message('Removing field "' . $fieldName . '" from fieldgroup "' . $template->fieldgroup->name . '"'); $field = $this->fields->get($fieldName); $template->fieldgroup->remove($field); } } $template->fieldgroup->save(); } }
  7. Consider this: You have a view to choose a set of fieldgroups / templates Once selected you'll get a list of matching fields (Only those fields that are used withing all fieldgroups of the initial selection) Applied changes will be reflected on all fieldgroups This would remove the need to maintain any sort of inheritance meta data but should be quite flexible. Maybe you can even add bookmarks for your fieldgroup selections. I consider developing such a module but I'd really like to hear from you guys whether there may be some drawbacks.
  8. This is still an issue and the solution seems legit. May there be a chance to get this upstream?
  9. Hello Tom, thank you for that hint. It may work in the most cases. Unfortunately in my special field setup it didn't work. Anyways I've came up with another solution: // Admin > Setup > Fields > Custom PHP code to find selectable pages $categories = $pages->find('has_parent="/categories/", template="category"'); foreach ($categories as &$category) { $breadcrumbs = wire('helper')->buildBreadcrumbList($category); $category->title = join(' / ', $breadcrumbs); } return $categories; Since I don't execute $category->save() that should be perfectly fine there and it seems to work like a charm without any side effects.
  10. Hello, it's very hard for me to describe the actual problem so I've attached two screenshots that contain all the required information. Basicly I'm trying to manipulate the page title that is rendered to the select field options within the page lister when setting up a filter using a PageField. (It's tedious to select the page you really want on duplicate titles) I can't find any solution to this problem. It doesnt seem to be as simple as hooking onto a render or textformat method. (Many attempts, no success ...) Please, can anyone help me out on this one?
  11. I'm still lookign for a solution to this.
  12. You're right I'm sorry. I couldn't find it on https://processwire.com/api/hooks/captain-hook/ Anyways I can't get this working :/ I'm currently using following Hooks to prevent page deletion and trashing. I even remove the delete tab from the page editor: $this->addHookBefore('Pages::trash', $this, 'preparePagesTrash'); $this->addHookBefore('Pages::delete', $this, 'preparePagesDelete'); $this->addHookAfter('ProcessPageEdit::buildFormDelete', $this, "removePageDeleteButton"); This works flawlessly. Anyways I couldn't get the /admin/page/ Page List Ajax trash button to alert the user. (Currently the system tells you that the page has been trashed even thought it didn't. Reload and I can see it's never been trashed) Is this even possible? I've tryed Page::deletable and even Page::trashable. There seems to be no way :-/ Maybe you can provide a brief example of how this should be working? Thank you very much.
  13. That's not a hookable method. I'm trying to do the same thing but am failing when it comes to the ajax trashing as superuser. (I can prevent the actual delete/trash but am unable to show some error message to the admin so he knows that he's got cheated by the system) Any help? What i currently have: public function init() { $this->pages->addHookBefore('delete', $this, 'deletePage'); $this->pages->addHookBefore('trash', $this, 'deletePage'); } public function deletePage(HookEvent $event) { // if page has ... some condition $this->error('Deleting this page is forbidden'); $event->replace = true; }
×
×
  • Create New...