-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
You can add pages via the "new" action on the pages in the page tree. The "add new" page/button are only shortcuts for pages to be created in predefined locations.
-
Module with more than one class? (the newb again)
LostKobrakai replied to swissdoode's topic in Module/Plugin Development
The only difference between a module and a normal php class (besides the content) is the file extension and that classname and filename do need to match. -
how do you pass variables between modules?
LostKobrakai replied to benbyf's topic in Module/Plugin Development
Is module 2 autoloaded and started before you trigger register in module 1? -
Repeater items and Pagefield label setting not working
LostKobrakai replied to Juergen's topic in General Support
{eventpricevariation.title} ? -
There are various different maps api's, so it might not be the one for the javascript map. On topic: You can store the key in any place you can exclude from source control, which is readable by php. The most common ones are probably .env files/ENV variables, or a config-something.php, which you include in your main config.php.
-
image httpUrl not woring in multi-instance
LostKobrakai replied to Gideon So's topic in General Support
I think this might not be a bug, but even intended. It seems pages are returned without output formatting being enabled, which results in the behaviour you're seeing. Iirc bootstrapping processwire will do the same, but I'm not 100% certain on that. If you want your field settings to be respected call ->setOutputFormatting(true) on the page obj. -
Mark Internal Links - Need HELP
LostKobrakai replied to PWaddict's topic in Module/Plugin Development
As you've already found nico's textformatter you could also use a:not(.external) to get all internal links. -
ProcessWire's core permission system currently falls short as soon as permissions need to be dynamic, e.g. if a user is part of a team or something like that. Basically everywhere were you cannot create a static role or permission per case. The dynamic roles module does help a bit, as you can dynamically assign those roles, but it's still one dynamic role per team (to stay with the above example). The optimal case would be to be able to have a single dynamic role, which would work like this: "If user is part of a team XY then give access to pages owned by team XY", where XY would be dynamically adjusted and not static.
-
How to get PageTable pages when not published
LostKobrakai replied to alexcapes's topic in API & Templates
Keep in mind that the find() in your example is only in-memory filtering. It cannot find additional pages.- 9 replies
-
- pagetable
- unpublished
-
(and 1 more)
Tagged with:
-
Error with Image Size from Joss Sanglier Tuts
LostKobrakai replied to Speed's topic in General Support
The images field by default does return a list of images and you cannot call size() on a list, but only on a single image. By using the settings of the field you can alter that behavior to only return a single image directly. -
separate OutPut of Date / Time from FieldType DateTime
LostKobrakai replied to bbeer's topic in General Support
@diogo That's not true, it won't work without curly braces, but it does with them. class Greeter{ public function greet() { return 'Hi!'; } } $greeter = new Greeter; echo "Trigger greeter: {$greeter->greet()}"; // Trigger greeter: Hi! @bbeer If you're not sure what you can do with a field, just var_dump($page->field) and it'll tell you what type the field does return. Only objects can give you the possibility to further customize the output via $page->field() or $page->field->someMethod(). A Datetime field will only return an integer or string. -
separate OutPut of Date / Time from FieldType DateTime
LostKobrakai replied to bbeer's topic in General Support
May I ask, where you got this code? $event->zeit is neither a function, nor a object you could call methods on. It's either a timestamp (integer) or a formatted string. I'm using this hook in my ready.php to have something a bit like you wanted to use: $wire->addHook("Page::getDate", function(HookEvent $event){ $page = $event->object; $fieldName = $event->arguments(0); $dateFormat = $event->arguments(1); $empty = $event->arguments(2) ?: ''; $field = $page->fields->get($fieldName); if(($field instanceof Field && $field->type == "FieldtypeDatetime") || $fieldName == "created" || $fieldName == "modified"){ $function = strpos($dateFormat, "%") !== false ? 'strftime' : 'date'; $raw = $page->getUnformatted($fieldName); return $event->return = $raw ? $function($dateFormat, $raw) : $empty; } }); It allows you to use this on datetime fields, no matter of the field settings: // date() syntax // => 04.02.2016 $page->getDate('zeit', 'd.m.Y'); // strftime syntax // => 4 Februar 2016 $page->getDate('zeit', '%e %B %Y'); // empty field value // => Nicht terminiert. $page->getDate('empty_zeit', '%e %B %Y', 'Nicht terminiert.'); // invalid field // => null $page->getDate('ziet', 'd.m.Y'); -
Hiding the Setup, Modules and Access top-nav tabs
LostKobrakai replied to Karlos's topic in General Support
Yeah the initial superusers id is hardcoded in the config, so you can't accidentally remove your own access rights. -
Hiding the Setup, Modules and Access top-nav tabs
LostKobrakai replied to Karlos's topic in General Support
The Modules section does only show up for superusers no matter what you do. Setup will only show those modules, where you explicitly gave the admin role a permission for (otherwise it's hidden). And Access depends on if admin does have the 'user-admin' permission. -
raw-read fild data with multilanguage content
LostKobrakai replied to vanderbreye's topic in API & Templates
$wire->addHook('Page::getLanguageJson', function(HookEvent $event) { $field = $event->arguments(0); $json = []; foreach($page->getLanguages() as $lang){ $json["$lang->id"] = $page->getLanguageValue($lang, $field); } $event->return = json_encode($json); });- 3 replies
-
- 1
-
- multilanguage
- core
-
(and 1 more)
Tagged with:
-
raw-read fild data with multilanguage content
LostKobrakai replied to vanderbreye's topic in API & Templates
Languages are not necessarily stored as json structure, but you can build it yourself using the functions you can see here under Language: https://processwire.com/api/ref/page/- 3 replies
-
- multilanguage
- core
-
(and 1 more)
Tagged with:
-
[solved] Urls without parents, double content?
LostKobrakai replied to rash's topic in Getting Started
Do you use $page->viewable() somewhere? It'll be false when using my method. -
[solved] Urls without parents, double content?
LostKobrakai replied to rash's topic in Getting Started
Rename your post.php to _post.php and instead of $post->render() use wireRenderFile("_post", ['page' => $post]). This way processwire doesn't automatically recognise that post does have a template file and therefore throws a 404 for those pages. -
ProcessWire and Google Cloud (Google App Engine)
LostKobrakai replied to tpr's topic in General Support
But it's a trouble you won't find a way around when trying to containerize/horizontally scale just about anything. You need to centralize logs, you need to centralize (server-side) sessions or don't use them. If it's worth depends on how big your need actually is to scale horizontally over multiple machines. -
ProcessWire and Google Cloud (Google App Engine)
LostKobrakai replied to tpr's topic in General Support
I think the cache wouldn't need to necessarily live outside the container, for logs I'd rather hook WireLog / Wire::trackExceptions and sending messages to a 3rd party service instead of trying to shoehorn external paths onto $config. Sessions could simply be SessionHandlerDB or a redis session handler via php conf. -
I'd imagine it should work like this: $this->add(array( // Text field: greeting array( 'name' => 'greeting', // name of field 'type' => 'text', // type of field (any Inputfield module name) 'label' => $this->_('Hello Greeting'), // field label 'description' => $this->_('What would you like to say to people using this module?'), 'required' => true, 'value' => $this->_('A very happy hello world to you.'), // default value ), // Radio buttons: greetingType array( 'name' => 'fs', 'type' => 'fieldset', 'children' => array( array( 'name' => 'greeting', // name of field 'type' => 'text', // type of field (any Inputfield module name) 'label' => $this->_('Hello Greeting'), // field label 'description' => $this->_('What would you like to say to people using this module?'), 'required' => true, 'value' => $this->_('A very happy hello world to you.'), // default value ), ) ) ));
-
I think this is only possible with ListerPro, where each lister is configurable.
- 1 reply
-
- 1
-
I'd expect some kind of memory leak in the compiler code, which is (at least partly) managed by the WireFileTools class. Maybe it's trying to hard to exclude your no-longer existing path you want to exclude.