Skip to content

Commit d590bb2

Browse files
committed
Update latest version
1 parent 7f8261c commit d590bb2

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

assets/src/js/pro/_acf-field-flexible-content.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,16 @@
332332

333333
// within layout
334334
var $layout = null;
335-
if ( $el.hasClass( 'acf-icon' ) ) {
335+
// Check the context data attribute to determine how to handle the add
336+
if ( $el.data( 'context' ) === 'layout' ) {
336337
$layout = $el.closest( '.layout' );
337338
$layout.addClass( '-hover' );
339+
} else if ( $el.data( 'context' ) === 'top-actions' ) {
340+
$layout = $el
341+
.closest( '.acf-flexible-content' )
342+
.find( '.values .layout' )
343+
.first();
344+
$layout.addClass( '-hover' );
338345
}
339346

340347
// new popup

assets/src/sass/pro/acf-pro-input.scss

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ html[dir=rtl] .acf-flexible-content .layout .acf-fc-layout-actions-wrap .acf-fc-
362362
display: flex
363363
}
364364

365-
.acf-flexible-content .layout>.acf-fields {
365+
.acf-flexible-content .layout>.acf-fields,
366+
.acf-flexible-content .layout>.acf-table {
366367
border: 1px solid rgba(0, 0, 0, 0);
367368
border-top: none
368369
}
@@ -422,7 +423,8 @@ html[dir=rtl] .acf-flexible-content .layout .acf-fc-layout-actions-wrap .acf-fc-
422423
box-shadow: 0 0 0 1px #fff
423424
}
424425

425-
.acf-flexible-content .layout.active-layout>.acf-fields {
426+
.acf-flexible-content .layout.active-layout>.acf-fields,
427+
.acf-flexible-content .layout.active-layout>.acf-table {
426428
background: rgba(56, 88, 233, .04);
427429
border: 1px solid rgba(56, 88, 233, .2)
428430
}
@@ -449,8 +451,8 @@ html[dir=rtl] .acf-flexible-content .layout .acf-fc-layout-actions-wrap .acf-fc-
449451
display: none;
450452
}
451453
.acf-flexible-content .layout > .acf-table {
452-
border: 0 none;
453454
box-shadow: none;
455+
box-sizing: border-box;
454456
}
455457
.acf-flexible-content .layout > .acf-table > tbody > tr {
456458
background: #fff;
@@ -565,8 +567,9 @@ body:not(.block-editor-page) .acf-flexible-content .layout.active-layout>.acf-fc
565567
background: #2271b1
566568
}
567569

568-
body:not(.block-editor-page) .acf-flexible-content .layout.active-layout>.acf-fields {
569-
background: rgba(34, 113, 177, .04)
570+
body:not(.block-editor-page) .acf-flexible-content .layout.active-layout>.acf-fields,
571+
body:not(.block-editor-page) .acf-flexible-content .layout.active-layout>.acf-table {
572+
background: rgba(34, 113, 177, .04)
570573
}
571574

572575
.rtl .acf-flexible-content .layout .acf-fc-layout-actions-wrap {
@@ -637,6 +640,9 @@ body:not(.block-editor-page) .acf-flexible-content .layout.active-layout>.acf-fi
637640
display: block;
638641
text-decoration: none;
639642
position: relative;
643+
overflow: hidden;
644+
text-overflow: ellipsis;
645+
white-space: nowrap;
640646
}
641647
.acf-fc-popup a:hover {
642648
color: #2271b1;

includes/fields/FlexibleContent/Layout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function render_as_table() {
201201
</tr>
202202
</thead>
203203
<tbody>
204-
<tr></tr>
204+
<tr><?php $this->sub_fields(); ?></tr>
205205
</tbody>
206206
</table>
207207
<?php
@@ -250,7 +250,7 @@ private function action_buttons() {
250250
<span class="acf-layout-disabled"><?php esc_html_e( 'Disabled', 'secure-custom-fields' ); ?></span>
251251
</div>
252252
<div class="acf-fc-layout-controls">
253-
<a class="acf-js-tooltip" href="#" data-name="add-layout" title="<?php esc_attr_e( 'Add layout', 'secure-custom-fields' ); ?>"><span class="acf-icon -plus-alt "></span></a>
253+
<a class="acf-js-tooltip" href="#" data-name="add-layout" data-context="layout" title="<?php esc_attr_e( 'Add layout', 'secure-custom-fields' ); ?>"><span class="acf-icon -plus-alt "></span></a>
254254
<a class="acf-js-tooltip" href="#" data-name="duplicate-layout" title="<?php esc_attr_e( 'Duplicate layout', 'secure-custom-fields' ); ?>"><span class="acf-icon -duplicate-alt"></span></a>
255255
<a class="acf-js-tooltip" aria-haspopup="menu" href="#" data-name="more-layout-actions" title="<?php esc_attr_e( 'More layout actions...', 'secure-custom-fields' ); ?>"><span class="acf-icon -more-actions"></span></a>
256256
<div class="acf-layout-collapse">

includes/fields/FlexibleContent/Render.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function actions( string $which = '' ) {
199199
<?php esc_html_e( 'Collapse All', 'secure-custom-fields' ); ?>
200200
</button>
201201
<span class="acf-separator"></span>
202-
<a class="acf-button button button-primary" href="#" data-name="add-layout">
202+
<a class="acf-button button button-primary" href="#" data-name="add-layout" data-context="top-actions">
203203
<i class="acf-icon -plus small"></i>
204204
<?php echo acf_esc_html( $this->field['button_label'] ); ?>
205205
</a>
@@ -208,7 +208,7 @@ private function actions( string $which = '' ) {
208208
} else {
209209
?>
210210
<div class="acf-actions">
211-
<a class="acf-button button button-primary" href="#" data-name="add-layout">
211+
<a class="acf-button button button-primary" href="#" data-name="add-layout" data-context="bottom-actions">
212212
<i class="acf-icon -plus small"></i>
213213
<?php echo acf_esc_html( $this->field['button_label'] ); ?>
214214
</a>
@@ -227,13 +227,15 @@ private function actions( string $which = '' ) {
227227
private function add_layout_menu() {
228228
echo '<script type="text-html" class="tmpl-popup"><ul>';
229229
foreach ( $this->layouts as $layout ) {
230-
$atts = array(
230+
$safe_label = acf_esc_html( $layout['label'] );
231+
$atts = array(
231232
'href' => '#',
232233
'data-layout' => $layout['name'],
233234
'data-min' => $layout['min'],
234235
'data-max' => $layout['max'],
236+
'title' => $safe_label,
235237
);
236-
printf( '<li><a %s>%s</a></li>', acf_esc_attrs( $atts ), acf_esc_html( $layout['label'] ) );
238+
printf( '<li><a %s>%s</a></li>', acf_esc_attrs( $atts ), $safe_label ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped above.
237239
}
238240
echo '</ul></script>';
239241
}

0 commit comments

Comments
 (0)