createSiteLocalPath($item['name'], $file); if (file_exists($metaPath)) { if (!@unlink($metaPath)) { throw new \API_Exception("Failed to remove afform overrides in $file"); } } } // We may have changed list of files covered by the cache. $scanner->clear(); // FIXME if `server_route` changes, then flush the menu cache. // FIXME if asset-caching is enabled, then flush the asset cache return $item; }); } /** * @return \Civi\Api4\Action\Afform\Update */ public static function update() { return new \Civi\Api4\Action\Afform\Update('Afform', __FUNCTION__, 'name'); } public static function getFields() { return new BasicGetFieldsAction('Afform', __FUNCTION__, function() { return [ [ 'name' => 'name', ], [ 'name' => 'requires', ], [ 'name' => 'title', ], [ 'name' => 'description', ], [ 'name' => 'is_public', 'data_type' => 'Boolean', ], [ 'name' => 'server_route', ], [ 'name' => 'layout', ], ]; }); } /** * @return array */ public static function permissions() { return [ "meta" => ["access CiviCRM"], "default" => ["administer CiviCRM"], ]; } }