πŸ‡ΊπŸ‡ΈUnited States @tripodcreative

Account created on 19 December 2013, over 10 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

@kporras07 - the more and more I look into this I think something is wrong on Pantheon. The dev + test envs have identical configs and databases, but it's broken on test but working on dev. I'm going to work with their team on this, and I will psot back here if I discover anything noteworthy.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

What's interesting is checking the link that the error says is a 404 is having connection issues - https://search-gateway-proxy-us-central1-b.svc.pantheon.io:443. Won't load up on my browser, says can't provide a secure connection. I wonder if that's the problem.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

I'm also getting errors related to guzzle:

GuzzleHttp\Exception\RequestException: cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 201 of /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php).

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

Sorry - I inadvertently pressed save on the file attachment so it saved early. I've updated this issue with attachments and details, and I'll close the duplicate issue that posted after.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

Update here: it appears that after disabling and uninstalling the module, the Title field element is moved to the disabled section of the form display, it doesn't reset to its default state.

While it would be preferable to have this state return to its original, this isn't so much of a bug as a missed configuration. For others who come across this issue themselves:

For the entity/node type in question, go to:

/admin/structure/types/manage/your_content_type_machine_name/form-display

And move the title form the disabled column at the bottom to the top of the page, or wherever else you'd like it to be.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

I can confirm that applying this patch on a D7 instance running PHP 7.4 fixed the issue. Thank you for providing this.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

Here's an easier way to do this:

1). Copy admin-block.html.twig from core/modules/system/templates/admin-block.html.twig into your admin theme.
2). Add this twig:

{% set class = block.title %}
{% set class = class|replace({' ':''}) %}
{% set class = class|lower %}
{%
  set classes = [
    'panel',
     class,
  ]
%}

Then, the <code><div{{ attributes.addClass(classes) }}>

will include the class name of the region, in this case, admintoolbarsearch

Then, in your admin theme, just

div.admintoolbarsearch {
display:none;
}
πŸ‡ΊπŸ‡ΈUnited States tripodcreative

I can confirm that this exact problem is happening again. I am unable to join Slack unless I have an association.drupal.org email address.

πŸ‡ΊπŸ‡ΈUnited States tripodcreative

I can confirm this works. My full code example for anyone who wants to reference off it:

<?php

namespace Drupal\applesauce_endpoint\Plugin\rest\resource;

use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;


/**
 * Provides a resource to get view modes by entity and bundle.
 * @RestResource(
 *   id = "pumpkin_user_first_sign_on",
 *   label = @Translation("pumpkin User First Sign On"),
 *   uri_paths = {
 *     "canonical" = "/pumpkin-rest/user-first-signon",
 *     "create" = "/pumpkin-rest/user-first-signon"
 *   }
 * )
 */


 

 class pumpkinRestResource extends ResourceBase {
    
    protected $loggedUser;
    /**
     * Constructs a Drupal\rest\Plugin\ResourceBase object.
     *
     * @param array $config
     *   A configuration array which contains the information about the plugin instance.
     * @param string $module_id
     *   The module_id for the plugin instance.
     * @param mixed $module_definition
     *   The plugin implementation definition.
     * @param array $serializer_formats
     *   The available serialization formats.
     * @param \Psr\Log\LoggerInterface $logger
     *   A logger instance.
     * @param \Drupal\Core\Session\AccountProxyInterface $current_user
     *   A currently logged user instance.
     */

     public function __construct(array $config, $module_id, $module_definition, array $serializer_formats, LoggerInterface $logger,AccountProxyInterface $current_user) {
        parent::__construct($config, $module_id, $module_definition, $serializer_formats, $logger);
        $this->loggedUser = $current_user;
      }

   /**
   * {@inheritdoc}
   */

   public static function create(ContainerInterface $container, array $config, $module_id, $module_definition) {
    return new static(
      $config,
      $module_id,
      $module_definition,
      $container->getParameter('serializer.formats'),
      $container->get('logger.factory')->get('applesauce_endpoint'),
      $container->get('current_user')
    );
  }

   /**
   * Responds to GET request.
   * Returns a list of taxonomy terms.
   * @throws \Symfony\Component\HttpKernel\Exception\HttpException
   * Throws exception expected.
   */
  
  public function get() {
    // Implementing our custom REST Resource here.
    // Use currently logged user after passing authentication and validating the access of term list.
    if (!$this->loggedUser->hasPermission('access content')) {
      throw new AccessDeniedHttpException();
    }	
  //Apples vocabulary
	$vid = 'apples';
	$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
	foreach ($terms as $term) {
	  $term_result[] = array(
	    'id' => $term->tid,
		'name' => $term->name
	  );
	}

    $response = new ResourceResponse($term_result);
    //Uncomment if desired to cache
    //$response->addCacheableDependency($term_result);
    return $response;
  }
  

    /**
   * @return \Drupal\rest\ResourceResponse
   *   The HTTP response objects
   */
    public function post(Request $request) {
      //Set second param of TRUE to have data returned as array as opposed to stdclass object
       $data = json_decode($request->getContent(), TRUE);
       //Dump data to watchdog for testing
       \Drupal::logger("pumpkinrest")->debug("Got a request:<pre>". print_r($data, true) ."</pre>");
       return  new ResourceResponse($data);
      }
    


    //End parent class
 }
πŸ‡ΊπŸ‡ΈUnited States tripodcreative

I can confirm this fix is working as well. My full code example follows:

<?php

namespace Drupal\applesauce_endpoint\Plugin\rest\resource;

use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;


/**
 * Provides a resource to get view modes by entity and bundle.
 * @RestResource(
 *   id = "pumpkin_user_first_sign_on",
 *   label = @Translation("pumpkin User First Sign On"),
 *   uri_paths = {
 *     "canonical" = "/pumpkin-rest/user-first-signon",
 *     "create" = "/pumpkin-rest/user-first-signon"
 *   }
 * )
 */


 

 class pumpkinRestResource extends ResourceBase {
    
    protected $loggedUser;
    /**
     * Constructs a Drupal\rest\Plugin\ResourceBase object.
     *
     * @param array $config
     *   A configuration array which contains the information about the plugin instance.
     * @param string $module_id
     *   The module_id for the plugin instance.
     * @param mixed $module_definition
     *   The plugin implementation definition.
     * @param array $serializer_formats
     *   The available serialization formats.
     * @param \Psr\Log\LoggerInterface $logger
     *   A logger instance.
     * @param \Drupal\Core\Session\AccountProxyInterface $current_user
     *   A currently logged user instance.
     */

     public function __construct(array $config, $module_id, $module_definition, array $serializer_formats, LoggerInterface $logger,AccountProxyInterface $current_user) {
        parent::__construct($config, $module_id, $module_definition, $serializer_formats, $logger);
        $this->loggedUser = $current_user;
      }

   /**
   * {@inheritdoc}
   */

   public static function create(ContainerInterface $container, array $config, $module_id, $module_definition) {
    return new static(
      $config,
      $module_id,
      $module_definition,
      $container->getParameter('serializer.formats'),
      $container->get('logger.factory')->get('applesauce_endpoint'),
      $container->get('current_user')
    );
  }

   /**
   * Responds to GET request.
   * Returns a list of taxonomy terms.
   * @throws \Symfony\Component\HttpKernel\Exception\HttpException
   * Throws exception expected.
   */
  
  public function get() {
    // Implementing our custom REST Resource here.
    // Use currently logged user after passing authentication and validating the access of term list.
    if (!$this->loggedUser->hasPermission('access content')) {
      throw new AccessDeniedHttpException();
    }	
  //Apples vocabulary
	$vid = 'apples';
	$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
	foreach ($terms as $term) {
	  $term_result[] = array(
	    'id' => $term->tid,
		'name' => $term->name
	  );
	}

    $response = new ResourceResponse($term_result);
    //Uncomment if desired to cache
    //$response->addCacheableDependency($term_result);
    return $response;
  }
  

    /**
   * @return \Drupal\rest\ResourceResponse
   *   The HTTP response objects
   */
    public function post(Request $request) {
      //Set second param of TRUE to have data returned as array as opposed to stdclass object
       $data = json_decode($request->getContent(), TRUE);
       //Dump data to watchdog for testing
       \Drupal::logger("pumpkinrest")->debug("Got a request:<pre>". print_r($data, true) ."</pre>");
       return  new ResourceResponse($data);
      }
    


    //End parent class
 }
Production build 0.69.0 2024