-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
There's also a way to add day to page on the fly. foreach($result as $res){ $res->day = strftime("%d",$res->getUnformatted("date")); } $results->sort("day");
-
Nope but you could store the weekday to a field and sort by it. This could be saved with a save hook.
-
I think he needs also edit access to articles to add children. I'm not sure I test and works fine here. Same as you set up but no page-publish permission, but works also with using it.
- 6 replies
-
- permissions
- template
-
(and 2 more)
Tagged with:
-
Finally. This was needed sooner or later.
-
No need for blank profile. Just replace site folder and import db. There will be no fields or templates from default... you replace them.
-
They set a index for the field in table. It's for optimizing when query database. Indexed field are faster to search.
-
How about $u = $users->find("roles=utente, roles!=superuser|guest");
-
Hooking into a Page field render - for all page fields
Soma replied to Sinmok's topic in Module/Plugin Development
Maybe the most natural and just general would be foreach($page->fields as $f) { echo "Type:$f->type Name: $f->name Label: $f->label<br>"; } $page->template->fields, $page->get("fields") etc A more deep hook into fields would be to hook formatValue(page, field, value) of Fieldtype. It will replace every title fields rendered on page also from other pages. $this->addHookAfter('Fieldtype::formatValue', $this, 'hookFields'); public function hookFields($event) { $page = $event->arguments("page"); $field = $event->arguments("field"); $value = $event->arguments("value"); // not sure this is needed here, and won't prevent from exec in admin. You better set module config to "autoload" => "template!=admin" if($page->template == "admin") return; if($field->name == "title"){ $event->return = "ohhhhhhh"; } } You could also just hook into specified field type like page title field $this->addHookAfter('FieldtypePageTitle::formatValue', $this, 'hookTitle'); You can also create your own property as per HelloWorld.module. But not overwrite already existing fields. $this->addHookProperty('Page::hello_world', $this, 'example4'); I'm not sure what you're trying to archive and if there isn't another approach, just mention ways... For example: You asked how to modify the page title. I showed you how and it's working. Fieldtype::formatValue will get called only when output formatting is on. And it's called when using TextFormatter modules on a field. -
Hooking into a Page field render - for all page fields
Soma replied to Sinmok's topic in Module/Plugin Development
Works fine $this->addHookBefore('Page::render', $this, 'renderHook'); public function renderHook($event) { $page = $event->object; if($page->template == 'admin') return; $page->title = "ohhhhhhh"; } Now the rendered page has always title ohhhhhhh. But this does not change the title for page in navigation or other places. -
So there will never be a 404 for those links? Seo?
-
Yeah you can now have all themes installed at once and also get all problems from all themes in one install. Yeah you can now have all themes installed at once and also get all problems from all themes in one install.
-
No it was fine until you changed something.
-
Can we please remove this module from directory already? Every other installs this instead of the core one and runs into problems!
-
... Attention: kongondo is on to about something ...
-
Maybe they're hidden or unpublished?
-
U all hace too cinplicated niknames.
-
To be honest, I'm not sure. Yes it's alpha/proof of concept but seems pretty stable and some use it already. But it also means it didn't get any love since then. I don't think there can happen much as it just creates pages with a image on it. So even you could go and do it without/remove ImagesManager. The parsing part for image tags could also be replaced or handled differently. It's all not things that can break easily or go competly wrong you wouldn't be able to fix somehow.
-
In ImagesManager I used to create a new PageImage before adding it so it will get resized according to max width settings. $im = new PageImage($page->images, $url_to_image); $page->images->add($im); https://github.com/somatonic/ImagesManager/blob/master/ImagesManager.module#L527
-
I'm not sure I can follow. It's there but can't output? You're using Inputfield here not a Field, you'll need to provide some method to store image after submit to a page. Depending what this code is for. You' also have to give a upload path to the inputfield. See some example of usage in my gist is helpful. https://gist.github.com/somatonic/5236008
-
Great thanks Ryan. This should have been in 2.4 stable
-
If you put it before default.php?
-
$config->dbSocket is not handled in WireDatabasePDO.php
Soma replied to interrobang's topic in API & Templates
Opening an issue on github would be better than here. Opening an issue on github would be better than here.