[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/js/bp-groups/js/blocks/dynamic-groups/ -> edit.js (source)

   1  /**
   2   * WordPress dependencies.
   3   */
   4  const {
   5      blockEditor: {
   6          InspectorControls,
   7      },
   8      components: {
   9          Disabled,
  10          PanelBody,
  11          RangeControl,
  12          SelectControl,
  13          TextControl,
  14          ToggleControl,
  15      },
  16      element: {
  17          Fragment,
  18          createElement,
  19      },
  20      i18n: {
  21          __,
  22      },
  23      serverSideRender: ServerSideRender,
  24  } = wp;
  25  
  26  /**
  27   * Internal dependencies.
  28   */
  29  import { TYPES } from './constants';
  30  
  31  const editDynamicGroupsBlock = ( { attributes, setAttributes } ) => {
  32      const { title, maxGroups, groupDefault, linkTitle } = attributes;
  33  
  34      return (
  35          <Fragment>
  36              <InspectorControls>
  37                  <PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>
  38                      <TextControl
  39                          label={ __( 'Title', 'buddypress' ) }
  40                          value={ title }
  41                          onChange={ ( text ) => {
  42                              setAttributes( { title: text } );
  43                          } }
  44                      />
  45                      <RangeControl
  46                          label={ __( 'Max groups to show', 'buddypress' ) }
  47                          value={ maxGroups }
  48                          onChange={ ( value ) =>
  49                              setAttributes( { maxGroups: value } )
  50                          }
  51                          min={ 1 }
  52                          max={ 10 }
  53                          required
  54                      />
  55                      <SelectControl
  56                          label={ __( 'Default groups to show', 'buddypress' ) }
  57                          value={ groupDefault }
  58                          options={ TYPES }
  59                          onChange={ ( option ) => {
  60                              setAttributes( { groupDefault: option } );
  61                          } }
  62                      />
  63                      <ToggleControl
  64                          label={ __( 'Link block title to Groups directory', 'buddypress' ) }
  65                          checked={ !! linkTitle }
  66                          onChange={ () => {
  67                              setAttributes( { linkTitle: ! linkTitle } );
  68                          } }
  69                      />
  70                  </PanelBody>
  71              </InspectorControls>
  72              <Disabled>
  73                  <ServerSideRender block="bp/dynamic-groups" attributes={ attributes } />
  74              </Disabled>
  75          </Fragment>
  76      );
  77  };
  78  
  79  export default editDynamicGroupsBlock;


Generated: Fri May 5 01:01:24 2023 Cross-referenced by PHPXref 0.7.1