You are here

public static function GetId3ConfigForm::afterBuild in getID3() 8

Verifies that getid3 is in the directory specified by the form element.

Checks that the directory in $form_element exists and contains files named 'getid3.php' and 'write.php'. If validation fails, the form element is flagged with an error.

Parameters

array $form_element: The form element containing the name of the directory to check.

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

array

File

src/Form/GetId3ConfigForm.php, line 108
Contains \Drupal\getid3\Form\GetId3ConfigForm.

Class

GetId3ConfigForm

Namespace

Drupal\getid3\Form

Code

public static function afterBuild(array $form_element, FormStateInterface $form_state) {
  $path = $form_state
    ->getValue('getid3_path');
  if (!is_dir($path) || !(file_exists($path . '/getid3.php') && file_exists($path . '/write.php'))) {
    drupal_set_message(t('The getID3 files <em>getid3.php</em> and <em>write.php</em> could not be found in the %path directory.', array(
      '%path' => $path,
    )), 'error');
  }
  return $form_element;
}