• Content Count

  • Joined

  • Last visited

  • Days Won


kixe last won the day on September 10

kixe had the most liked content!

Community Reputation

965 Excellent

About kixe

  • Rank
    Hero Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Cologne, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Since PW >= 3.0.105 you can easily use the following hook. $wire->addHookBefore('InputfieldSelect::render', function($e) { if ($e->object->name != 'myfield') return; // quick exit if fieldname doesn't match $restrictedIDs = array(); // array of option values to be modified, page IDs in case of pagefield $optionAttributes = array_fill_keys($restrictedIDs, array('disabled' => 'disabled')); $e->object->addOptionAttributes($optionAttributes); }); Related commit:
  2. kixe

    Maybe related: $page->children->sort('title') // case sensitive sort $page->children('sort=title') // case insensitive sort
  3. kixe

    The function getRandom() returns null if the field is empty and not an empty object. You cannot call a function from null. You need to check first if the image object exists. Make also sure your selector $targetPageId includes only pages having a field 'images'. Try this: $randomImage = !empty($pages->get($targetPageId)->images->getRandom())? $pages->get($targetPageId)->images->getRandom()->width(400) : null;
  4. kixe __construct() is called automatically. init() not. Every property defined/ populated with __construct() is accessible inside the class/ module and outside if public. If you define properties or change their values with init() you have no access inside a function of your class without calling init() from inside this function. If you init a module the processwire way inside a template you get what you expect. EXAMPLE <?php namespace ProcessWire; class TestModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => "Test Module", 'version' => 1, ); } public $colours = array(); public function __construct() { $this->colours = array( 'Blue' ); } public function init() { $this->colours = array( 'Red', 'Orange', 'Yellow' ); } public function getColourArray() { return $this->colours; } } If you call Module/ Class via ProcessWire or directly inside your template you will get different results: <?php namespace ProcessWire; // INSTANTIATE VIA PW var_dump($modules->TestModule->getColourArray()); // init() is called by PW // array(3) { [0]=> string(3) "Red" [1]=> string(6) "Orange" [2]=> string(6) "Yellow" } // INSTANTIATE CLASS $test = new TestModule(); // the PHP way, init() is not called var_dump($test->getColourArray()); // array(1) { [0]=> string(4) "Blue" } // CALL INIT AND CHANGE RESULT $test->init(); var_dump($test->getColourArray()); // array(3) { [0]=> string(3) "Red" [1]=> string(6) "Orange" [2]=> string(6) "Yellow" }
  5. I added some extra buttons to ProcessPageList. I need a quick solution to add a title attribute or option to modify the rendered markup to apply a tooltip.
  6. I don't remember where I pulled this illustration from. I maybe found it somewhere here in the forum or here It corresponds largely to my personal experience. Another dimension, called 'security' is missing and would also help to make a good decision ...
  7. make all languages viewable and put the following code in your home template if ($user->language->isDefault() === false) { $session->redirect($page->localUrl($languages->getDefault())); }
  8. In fact, these modules are very similar. That's why I did not publish my module in the Processwire module directory. small differences: I use the builtin InputfieldMarkup I don't use eval() No need to create a new field if used in another template. Simply overwrite the output template based. The basic usecase is to set the markup field and template/field based. Via string tags all pagefield values and other page properties are accessible. Any textformatter can be applied. Full Language support. For more complex calculations the output is hookable and the full PW API can be used to create the output, not only $page or $pages. Example: A page (A) has been assigned to another page (B) via a page field. I want to show some informations about (B) inside (A)
  9. This fieldtype will generate any runtime markup:
  10. kixe

    As you know I tested the module with several different javascript based color pickers via the included custom script option. I will leave this as is. Use and modify the picker you like. Another thing is the dynamically change of the input and background color in the Textfield. This is pretty good and if I find time I will implement this.
  11. kixe

    @Robin S Useful textformatter in case of multiline content. If you want to hide text without linebreaks you can also use Core TextformatterMarkdownExtra:
  12. kixe

    @adrian Thanks for pointing on this. I added a fallback to the standard dechex() function for 64-bit systems. In the rare case that neither the BCMath extension is installed nor the system can handle 64-bit integers, the module is not installable.
  13. kixe

    Once I made a nice Fieldtype for this. Please try out
  14. kixe

    With PW this is only possible for subdomains. $this->config->sessionCookieDomain = ''; This setting includes:
  15. Just to clarify: Usually there is only one instance/ object of ProcessWire which is the ProcessWire boot object represented by the variable $wire. ProcessWire is a child class of Wire. Assuming you are talking about all Wire objects the answer is YES and more: // Access to a wire object from inside a wire derived class: $pages = $this->wire('pages'); // Access to the current ProcessWire instance: $wire = $this->wire(); // Create new wire object inside your ready.php $this->wire('ferry', '/site/translations.php'); Read more: