Merge branch '2.8'
* 2.8: add dependency required by a replaced package Add a way to group toolbar info pieces Added general sf-toolbar-block-right class Bind input before executing the COMMAND event
This commit is contained in:
commit
1bcce3c376
@ -31,6 +31,7 @@
|
|||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{% set text %}
|
{% set text %}
|
||||||
|
<div class="sf-toolbar-info-group">
|
||||||
{% if collector.applicationname %}
|
{% if collector.applicationname %}
|
||||||
<div class="sf-toolbar-info-piece">
|
<div class="sf-toolbar-info-piece">
|
||||||
<b>{{ collector.applicationname }}</b>
|
<b>{{ collector.applicationname }}</b>
|
||||||
@ -69,7 +70,9 @@
|
|||||||
<span class="{{ debug_status_class }}">{{ collector.debug ? 'enabled' : 'disabled' }}</span>
|
<span class="{{ debug_status_class }}">{{ collector.debug ? 'enabled' : 'disabled' }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sf-toolbar-info-group">
|
||||||
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
|
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
|
||||||
<b>PHP version</b>
|
<b>PHP version</b>
|
||||||
<span>
|
<span>
|
||||||
@ -88,8 +91,9 @@
|
|||||||
<b>PHP SAPI</b>
|
<b>PHP SAPI</b>
|
||||||
<span>{{ collector.sapiName }}</span>
|
<span>{{ collector.sapiName }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sf-toolbar-info-group">
|
||||||
{% if collector.symfonyversion is defined %}
|
{% if collector.symfonyversion is defined %}
|
||||||
<div class="sf-toolbar-info-piece">
|
<div class="sf-toolbar-info-piece">
|
||||||
<b>Resources</b>
|
<b>Resources</b>
|
||||||
@ -106,9 +110,10 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status }) }}
|
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right' }) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block menu %}
|
{% block menu %}
|
||||||
|
@ -104,6 +104,16 @@
|
|||||||
.sf-toolbar-block .sf-toolbar-info-piece-additional-detail {
|
.sf-toolbar-block .sf-toolbar-info-piece-additional-detail {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.sf-toolbar-block .sf-toolbar-info-group {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
border-bottom: 1px solid #333333;
|
||||||
|
}
|
||||||
|
.sf-toolbar-block .sf-toolbar-info-group:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status {
|
.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status {
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
@ -436,7 +446,7 @@
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-toolbar-block-config {
|
.sf-toolbar-block-right {
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }}">
|
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}">
|
||||||
{% if link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
|
{% if link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %}
|
||||||
<div class="sf-toolbar-icon">{{ icon|default('') }}</div>
|
<div class="sf-toolbar-icon">{{ icon|default('') }}</div>
|
||||||
{% if link %}</a>{% endif %}
|
{% if link %}</a>{% endif %}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Console;
|
namespace Symfony\Component\Console;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
||||||
use Symfony\Component\Console\Helper\ProcessHelper;
|
use Symfony\Component\Console\Helper\ProcessHelper;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
@ -787,6 +788,14 @@ class Application
|
|||||||
return $command->run($input, $output);
|
return $command->run($input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bind before the console.command event, so the listeners have access to input options/arguments
|
||||||
|
try {
|
||||||
|
$command->mergeApplicationDefinition();
|
||||||
|
$input->bind($command->getDefinition());
|
||||||
|
} catch (ExceptionInterface $e) {
|
||||||
|
// ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition
|
||||||
|
}
|
||||||
|
|
||||||
$event = new ConsoleCommandEvent($command, $input, $output);
|
$event = new ConsoleCommandEvent($command, $input, $output);
|
||||||
$this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
|
$this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Console\Command;
|
namespace Symfony\Component\Console\Command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Console\Input\InputDefinition;
|
use Symfony\Component\Console\Input\InputDefinition;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
@ -218,7 +219,7 @@ class Command
|
|||||||
// bind the input against the command specific arguments/options
|
// bind the input against the command specific arguments/options
|
||||||
try {
|
try {
|
||||||
$input->bind($this->definition);
|
$input->bind($this->definition);
|
||||||
} catch (\Exception $e) {
|
} catch (ExceptionInterface $e) {
|
||||||
if (!$this->ignoreValidationErrors) {
|
if (!$this->ignoreValidationErrors) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
@ -920,6 +920,63 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode);
|
$this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRunWithDispatcherAccessingInputOptions()
|
||||||
|
{
|
||||||
|
$noInteractionValue = null;
|
||||||
|
$quietValue = null;
|
||||||
|
|
||||||
|
$dispatcher = $this->getDispatcher();
|
||||||
|
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use (&$noInteractionValue, &$quietValue) {
|
||||||
|
$input = $event->getInput();
|
||||||
|
|
||||||
|
$noInteractionValue = $input->getOption('no-interaction');
|
||||||
|
$quietValue = $input->getOption('quiet');
|
||||||
|
});
|
||||||
|
|
||||||
|
$application = new Application();
|
||||||
|
$application->setDispatcher($dispatcher);
|
||||||
|
$application->setAutoExit(false);
|
||||||
|
|
||||||
|
$application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) {
|
||||||
|
$output->write('foo.');
|
||||||
|
});
|
||||||
|
|
||||||
|
$tester = new ApplicationTester($application);
|
||||||
|
$tester->run(array('command' => 'foo', '--no-interaction' => true));
|
||||||
|
|
||||||
|
$this->assertTrue($noInteractionValue);
|
||||||
|
$this->assertFalse($quietValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRunWithDispatcherAddingInputOptions()
|
||||||
|
{
|
||||||
|
$extraValue = null;
|
||||||
|
|
||||||
|
$dispatcher = $this->getDispatcher();
|
||||||
|
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) use (&$extraValue) {
|
||||||
|
$definition = $event->getCommand()->getDefinition();
|
||||||
|
$input = $event->getInput();
|
||||||
|
|
||||||
|
$definition->addOption(new InputOption('extra', null, InputOption::VALUE_REQUIRED));
|
||||||
|
$input->bind($definition);
|
||||||
|
|
||||||
|
$extraValue = $input->getOption('extra');
|
||||||
|
});
|
||||||
|
|
||||||
|
$application = new Application();
|
||||||
|
$application->setDispatcher($dispatcher);
|
||||||
|
$application->setAutoExit(false);
|
||||||
|
|
||||||
|
$application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) {
|
||||||
|
$output->write('foo.');
|
||||||
|
});
|
||||||
|
|
||||||
|
$tester = new ApplicationTester($application);
|
||||||
|
$tester->run(array('command' => 'foo', '--extra' => 'some test value'));
|
||||||
|
|
||||||
|
$this->assertEquals('some test value', $extraValue);
|
||||||
|
}
|
||||||
|
|
||||||
public function testTerminalDimensions()
|
public function testTerminalDimensions()
|
||||||
{
|
{
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
"php": ">=5.5.9",
|
"php": ">=5.5.9",
|
||||||
"symfony/event-dispatcher": "~2.8|~3.0",
|
"symfony/event-dispatcher": "~2.8|~3.0",
|
||||||
"symfony/http-foundation": "~2.8|~3.0",
|
"symfony/http-foundation": "~2.8|~3.0",
|
||||||
"symfony/http-kernel": "~2.8|~3.0"
|
"symfony/http-kernel": "~2.8|~3.0",
|
||||||
|
"symfony/property-access": "~2.8|~3.0.0"
|
||||||
},
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
"symfony/security-core": "self.version",
|
"symfony/security-core": "self.version",
|
||||||
|
Reference in New Issue
Block a user