|
@@ -63,6 +63,7 @@ class StatusForm extends FormBase {
|
|
|
public function buildForm(array $form, FormStateInterface $form_state) {
|
|
|
|
|
|
|
|
|
+
|
|
|
$form['#attached']['library'][] = 'statusmessage/status';
|
|
|
|
|
|
if (\Drupal::moduleHandler()->moduleExists('heartbeat')) {
|
|
@@ -88,18 +89,31 @@ class StatusForm extends FormBase {
|
|
|
],
|
|
|
);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ $form['mediatabs'] = [
|
|
|
+ '#type' => 'radios',
|
|
|
+
|
|
|
+ '#prefix' => '<div class="status-media-upload"></div>',
|
|
|
+
|
|
|
+ '#options' => $this->mediaTabs,
|
|
|
+ '#theme' => 'status-form-element',
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ];
|
|
|
+
|
|
|
+ $form['media'] = [
|
|
|
+ '#type' => 'managed_file',
|
|
|
+ '#upload_location' => 'public://statusmessage/',
|
|
|
+ '#states' => array(
|
|
|
+ 'visible' => array(
|
|
|
+ ':input[name="File_type"]' => array('value' => t('Upload Your File')),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ];
|
|
|
|
|
|
|
|
|
$form['post'] = array(
|
|
@@ -180,45 +194,14 @@ $stophere = null;
|
|
|
$response->addCommand(new ClientCommand($url[0]));
|
|
|
|
|
|
return $response;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ return null;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
public function statusAjaxSubmit(array &$form, FormStateInterface $form_state) {
|
|
|
$message = $form_state->getValue('message');
|
|
|
+ $file = $form_state->getValue('media');
|
|
|
if (strlen(trim($message)) > 1) {
|
|
|
preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $message, $match);
|
|
|
|