Error trying to add a new Field in v3.8 - Pages and Posts Module
kiltedup opened this issue · comments
Error is thrown in 3.8 when trying to add a new field in Posts and Pages module (possibly others - not tested)
After choosing the required field type, following error is displayed:
"Missing required parameters for [Route: anomaly.module.pages::fields.change] [URI: admin/pages/fields/change/{id}]."
/Applications/MAMP/htdocs/tinyg/tinyg.info/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php
<?php
namespace Illuminate\Routing\Exceptions;
use Exception;
class UrlGenerationException extends Exception
{
/**
* Create a new exception for missing route parameters.
*
* @param \Illuminate\Routing\Route $route
* @return static
*/
public static function forMissingParameters($route)
{
return new static("Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].");
}
}
Issue does not occur when editing an existing field.
Problem seems to originate from :
Anomaly\Streams\Platform\Field\Form\FieldFormButtons
Commenting out the change option when setting buttons, removes the issue ( and of course the change button ) :
class FieldFormButtons
{
/**
* Handle the buttons.
*
* @param FieldFormBuilder $builder
* @param ModuleCollection $modules
* @param Route $route
* @param UrlGenerator $url
*/
public function handle(FieldFormBuilder $builder, ModuleCollection $modules, Route $route, UrlGenerator $url)
{
$module = $modules->active();
$field = $builder->getFormEntry();
$type = $field->getType();
$builder->setButtons(
[
'cancel',
// 'change' => [
// 'data-toggle' => 'modal',
// 'data-target' => '#modal',
// 'disabled' => $builder->getFormMode() == 'edit'
// && !$type->getColumnType(),
// 'enabled' => $builder->getFormMode() == 'edit'
// && $module
// && $url->hasRoute($module->getNamespace('fields.change')),
// 'href' => $url->route(
// $module->getNamespace('fields.change'),
// ['id' => $route->parameter('id')]
// ),
// ],
]
);
}
}
This issue is one of several affecting using Pyro 3.8 as a new install or as an upgrade from 3.7
This has been resolved: anomalylabs/streams-module@852bc48