You are here

protected function PublicFieldInfoBase::process in RESTful 7.2

Processes the provided data for the section.

@returns array The processed section info.

Parameters

string $section_name: The name of the categories. By default RESTful supports 'info', 'form_element' and 'data'.

array $section_info: The structured array with the section information.

1 call to PublicFieldInfoBase::process()
PublicFieldInfoBase::addCategory in src/Plugin/resource/Field/PublicFieldInfo/PublicFieldInfoBase.php
Add categories to the field info.

File

src/Plugin/resource/Field/PublicFieldInfo/PublicFieldInfoBase.php, line 145
Contains \Drupal\restful\Plugin\resource\Field\PublicFieldInfo\PublicFieldInfoBase.

Class

PublicFieldInfoBase

Namespace

Drupal\restful\Plugin\resource\Field\PublicFieldInfo

Code

protected function process($section_name, array $section_info) {
  if ($section_name == 'data') {
    if ($section_info['type'] == 'string') {
      $section_info['size'] = isset($section_info['size']) ? $section_info['size'] : 255;
    }
  }
  elseif ($section_name == 'form_element') {

    // Default title and description to the ones in the 'info' section.
    if (empty($section_info['title'])) {
      $section_info['title'] = empty($this->categories['info']['title']) ? $this->fieldName : $this->categories['info']['title'];
      if (!empty($this->categories['info']['description'])) {
        $section_info['description'] = $this->categories['info']['description'];
      }
    }
  }
  return $section_info;
}