PHP code example of getpop / component-model-configuration

1. Go to this page and download the library: Download getpop/component-model-configuration 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/ */

    

getpop / component-model-configuration example snippets


// Implement the components properties ...
function getImmutableConfiguration($component, &$props) 
{
  $ret = parent::getImmutableConfiguration($component, $props);

  switch ($component->name) {
    case self::COMPONENT_SOMENAME:
      $ret['description'] = __('Some description');
      $ret['classes']['description'] = 'jumbotron';
      break;
  }

  return $ret;
}

// Implement the components properties ...
function getImmutableConfiguration($component, &$props) 
{
  $ret = parent::getImmutableConfiguration($component, $props);

  switch ($component->name) {
    case self::COMPONENT_SOMENAME:
      $ret['showmore'] = $this->getProp($component, $props, 'showmore');
      $ret['class'] = $this->getProp($component, $props, 'class');
      break;
  }

  return $ret;
}

function initModelProps($component, &$props) 
{
  switch ($component->name) {
    case self::COMPONENT_SOMENAME:      
      $this->setProp($component, $props, 'showmore', false);
      $this->appendProp($component, $props, 'class', 'text-center');
      break;
  }

  parent::initModelProps($component, $props);
}
 php
\PoP\Root\App::stockAndInitializeModuleClasses([([
    \PoP\ConfigurationComponentModel\Module::class,
]);
 bash
composer analyse