<p dir="auto">At the moment there's no way that I can see to pass attr attributes through to the separate date and time child widgets of a datetime instance. This is easy to fix and I'm happy to put together a PR if people think it's a good idea.</p>
<p dir="auto">The proposed solution is:</p>
<ul dir="auto">
<li>add <code class="notranslate">date_widget_attr</code> and <code class="notranslate">time_widget_attr</code> options to DateTimeType, which default to <code class="notranslate">array()</code></li>
<li>in DateTimeType::buildForm(), pass these values through to the child widgets, using calls like <code class="notranslate">$dateOptions['attr'] = $options['date_widget_attr'];</code></li>
<li>add related tests and documentation</li>
</ul>
<p dir="auto">As far as I can see, that's all that's needed (and is working in my local code).</p>
<p dir="auto">Let me know if this is considered useful and I'll put together a PR.</p>
<p dir="auto">We currently use various different ways for influencing the options of the children of an added type:</p>
<p dir="auto">a) By letting <em>one</em> option accept <em>multiple values</em> for the children (e.g. the "empty_value" option in DateType)</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$form-&gt;add('updatedAt', 'date', array(
    'empty_value' =&gt; array(
        'day' =&gt; 'The day...',
    ),
));"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'date'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'empty_value'</span> =&gt; <span class="pl-en">array</span>(
        <span class="pl-s">'day'</span> =&gt; <span class="pl-s">'The day...'</span>,
    ),
));</pre></div>
<p dir="auto">b) By having dedicated "options" options (e.g. "options" in CollectionType, "first_options"/"second_options" in RepeatedType)</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$form-&gt;add('password', 'repeated', array(
    'type' =&gt; 'password',
    'first_options' =&gt; array(
        'required' =&gt; true,
    ),
));"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'password'</span>, <span class="pl-s">'repeated'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'type'</span> =&gt; <span class="pl-s">'password'</span>,
    <span class="pl-s">'first_options'</span> =&gt; <span class="pl-en">array</span>(
        <span class="pl-s">'required'</span> =&gt; <span class="pl-c1">true</span>,
    ),
));</pre></div>
<p dir="auto">And in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="4017499" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/3825" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/3825/hovercard" href="https://github.com/symfony/symfony/pull/3825">#3825</a>, a third possibility was suggested:</p>
<p dir="auto">c) By having <em>one</em> dedicated option per child and option (e.g. "day_widget", "month_widget" etc.)</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$form-&gt;add('updatedAt', 'date', array(
    'day_widget' =&gt; 'text',
    'month_widget' =&gt; 'choice',
));"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'date'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'day_widget'</span> =&gt; <span class="pl-s">'text'</span>,
    <span class="pl-s">'month_widget'</span> =&gt; <span class="pl-s">'choice'</span>,
));</pre></div>
<p dir="auto">These different alternatives</p>
<ul dir="auto">
<li>are inconsistent</li>
<li>need to be implemented manually</li>
<li>need to be changed whenever a new child option should be supported</li>
</ul>
<p dir="auto">Therefore I propose adding a generic way for overriding nested options by supporting a special syntax in the options array:</p>
<p dir="auto"><code class="notranslate">@child(/nestedChild)*[#option]</code></p>
<p dir="auto">Examples:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$builder-&gt;add('updatedAt', 'datetime', array(
    '@date' =&gt; array(
        'required' =&gt; true,
        '@day' =&gt; array(
            'empty_value' =&gt; 'The day...',
        ),
    ),
));

// equivalent to

$builder-&gt;add('updatedAt', 'datetime', array(
    '@date' =&gt; array(
        'required' =&gt; true,
    ),
    '@date/day' =&gt; array(
        'empty_value' =&gt; 'The day...',
    ),
));

// equivalent to

$builder-&gt;add('updatedAt', 'datetime', array(
    '@date#required' =&gt; true,
    '@date/day#empty_value' =&gt; 'The day...',
));"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'datetime'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'@date'</span> =&gt; <span class="pl-en">array</span>(
        <span class="pl-s">'required'</span> =&gt; <span class="pl-c1">true</span>,
        <span class="pl-s">'@day'</span> =&gt; <span class="pl-en">array</span>(
            <span class="pl-s">'empty_value'</span> =&gt; <span class="pl-s">'The day...'</span>,
        ),
    ),
));

<span class="pl-c">// equivalent to</span>

<span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'datetime'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'@date'</span> =&gt; <span class="pl-en">array</span>(
        <span class="pl-s">'required'</span> =&gt; <span class="pl-c1">true</span>,
    ),
    <span class="pl-s">'@date/day'</span> =&gt; <span class="pl-en">array</span>(
        <span class="pl-s">'empty_value'</span> =&gt; <span class="pl-s">'The day...'</span>,
    ),
));

<span class="pl-c">// equivalent to</span>

<span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'datetime'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'@date#required'</span> =&gt; <span class="pl-c1">true</span>,
    <span class="pl-s">'@date/day#empty_value'</span> =&gt; <span class="pl-s">'The day...'</span>,
));</pre></div>
<p dir="auto">Additionally, setting an option for all children at once should be supported:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$builder-&gt;add('updatedAt', 'datetime', array(
    '@date/*#empty_value' =&gt; '...',
));"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'updatedAt'</span>, <span class="pl-s">'datetime'</span>, <span class="pl-en">array</span>(
    <span class="pl-s">'@date/*#empty_value'</span> =&gt; <span class="pl-s">'...'</span>,
));</pre></div>
<p dir="auto">References:</p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="4017499" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/3825" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/3825/hovercard" href="https://github.com/symfony/symfony/pull/3825">#3825</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="9284560" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/6350" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/6350/hovercard" href="https://github.com/symfony/symfony/issues/6350">#6350</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="10424905" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/6910" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/6910/hovercard" href="https://github.com/symfony/symfony/pull/6910">#6910</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="16236996" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/8396" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/8396/hovercard" href="https://github.com/symfony/symfony/issues/8396">#8396</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="16466738" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/8443" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/8443/hovercard" href="https://github.com/symfony/symfony/issues/8443">#8443</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="25518955" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/10012" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/10012/hovercard" href="https://github.com/symfony/symfony/pull/10012">#10012</a></li>
</ul>