PHP code example of umd_digital / umd_terp_base

1. Go to this page and download the library: Download umd_digital/umd_terp_base library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

umd_digital / umd_terp_base example snippets


function YOUR_CUSTOM_MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // Hide the sidebar boolean.
  if ($form_id == 'node_umd_terp_basic_page_form' || $form_id = 'node_umd_terp_basic_page_edit_form') {
    if ( isset($form['field_umdt_ct_hide_sidebar'])) {
      $form['field_umdt_ct_hide_sidebar']['#access'] = FALSE;
    }
  }
}

function YOUR_CUSTOM_MODULE_field_widget_paragraphs_form_alter(&$element, &$form_state, $context) {
  // Remove light/dark choice from UT Blockquote.
  if ($element['#paragraph_type'] == 'ut_blockquote') {
    if (isset($element['subform']['field_ut_blockquote_style'])) {
      $element['subform']['field_ut_blockquote_style']['#access'] = FALSE;
    }
  }
}