protected function handleThumbs() { fx::listen('unlink', function ($e) { $f = $e['file']; if (fx::files()->isMetaFile($f)) { return; } if (fx::path()->isInside($f, fx::path('@thumbs'))) { return; } if (!fx::path()->isInside($f, fx::path('@content_files'))) { return; } $thumbs = \Floxim\Floxim\System\Thumb::findThumbs($f); foreach ($thumbs as $thumb) { fx::files()->rm($thumb); } }); }
public function init() { fx::template()->import('floxim.layout.wrapper'); fx::listen('before_save', function ($e) { $entity = $e['entity']; if (!$entity instanceof \Floxim\Floxim\Component\InfoblockVisual\Entity) { return; } if (!preg_match("~column_new-in-(\\d+)~", $entity['area'], $column_infoblock_id)) { return; } $column_infoblock_id = $column_infoblock_id[1]; $column = fx::data('floxim.layout.column')->create(array('infoblock_id' => $column_infoblock_id)); if (preg_match("~(before|after)-(\\d+)~", $entity['area'], $rel_col)) { $column['__move_' . $rel_col[1]] = $rel_col[2]; } fx::log($rel_col, $column); $column->save(); $entity['area'] = $column['area_keyword']; }); }
public function getAreas() { $areas = array(); ob_start(); fx::listen('render_area.get_areas', function ($e) use(&$areas) { $areas[$e['area']['id']] = $e['area']; }); $this->render(array('_idle' => true)); fx::unlisten('render_area.get_areas'); // hm, since IB render res is cached, we can not just remove added files // because they won't be added again // may be we should switch off caching for idle mode //fx::page()->clear_files(); ob_get_clean(); return $areas; }