texts: How to add multiple "submit" buttons in Webform

texts:
If I add a button to a webform creating a module with something like this in it:

$form['actions']['submit_2'] = array(
  '#type' => 'submit',
  '#value' => t('Submit 2'),
);

It appears in my webform, but it doesn't submit the webform.

If I add a custom handler for this button like this:

$form['actions']['submit_start'] = array(
  '#type' => 'submit',
  '#value' => t('Début du Changement'),
  '#submit' => array(custom_handler),
);

When I click it, the custom_handler is called but the webform is not submitted.

How can I add multiple buttons that all submits the webform, but some add this submission other functions (like a specific "drupal_set_message")?


texts:
I read How do I find the search block form ID? several days ago. I want to use the answer given there in my project.

Where should I add this code in my project? Where can I find more information about it?

$form =\Drupal::service('class_resolver')-getInstanceFromDefinition('Drupal\mymodule\Form\Mymodule\SearchBlockForm');
$form->setFormIdentifier('some_custom_value');
return \Drupal::formBuilder()->getForm($form);

The key line of code here is this one:

$form->setFormIdentifier('some_custom_value');

Can you explain me what the code does?


texts: How can I replace a node reference field with a node edit form?

texts:
I have two content types - parent and child. There is a one to many relationship (many children to one parent). I am migrating this content, and the current situation is that that node reference field is on the child, pointing to the parent. However, I may be able to change this to have a node reference field on the parent set to an unlimited number of items (though its probably better if I keep the existing "schema" to avoid problems after migration).

I would like to create a node edit form for the parent. In this node edit form, I want to have the child node edit form embedded on the same page, either as a replacement for the node reference field, or as a view displaying node edit forms of existing children of parent. I will create an interface that displays the child node edit form(s) when the user clicks on an accordion-like button at the top of the form, and beneath the form, a "Add another", which creates a new child node add form.

My first thoughts are to over-ride the template of the node reference field to embed the node edit form in the theme. However, this method seems to have potential side effects that have to be dealt with, as the current "schema" is the child nodes pointing to the parent nodes, which I prefer to keep.

My ideal solution is to use panels, but after playing with panels and doing some googling, I haven't found a solution that is specific to my needs.

How do I embed the form (either an existing node edit form or a node add form with a node reference field pre-populated) using panels? Is that even possible? If not, what is the best way to accomplish this?


texts: Intercept 404s for pages in certain path

texts:
I have a site that regularly adds & removes event nodes based on a third party system. When these nodes are removed, any other articles that link to them get 404 pages. Is there a way I could intercept the 404 results for pages with a certain path and redirect them to the event landing page instead?

I have tried adding the following to template.php but I get a redirect loop

function MYTHEME_preprocess_page(&$vars)
{
    // Redirect expired events
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found" && preg_match('/\/events\//', request_uri())) {
        drupal_set_message('Sorry, this event is no longer available','error');
        drupal_goto('/events/');
    }
}


texts: Server 500 error in a View which is working perfectly outside of the admin area

texts:
I have a View which is affected by several hooks ( views_pre_viewand views_query_alter, mainly). It works perfectly in the final user area, but when I am logged and go to the Views GUI, the browser displays the following error message:

 An AJAX HTTP error occurred.
 HTTP Result Code: 500
 Debugging information follows.
 Path: en/admin/structure/views/view/NAME_OF_VIEW/preview/block/ajax
 StatusText: Internal Server Error
 ResponseText:

I see no error loging in the recent log messages, the browser keeps working, I can modify the View, but I am worried that something may broke later in the final user area. How can I debug what is happening? I have no previous experience in Devel or similar.


texts: How to display node number in content items that only show up to administrators on ALL content items?

texts:
Evertime I need to node number I need to go to content items and hover over it, memorize and use it after...

Is there a way to have the node number displayed on the content item, but only to administrator.

Is there a module for this? Or would I have to create a custom field with a token and add it to every display...?


texts:
Is there a way to change the order of execution of hook_form_alter in Drupal 7 without changing a module's weight or hacking Drupal Core?

I am trying to alter the element added in translation_form_node_form_alter from the translation module. When debugging the form I can't find the element so I assume my hook is being executed before the one in the translation module is.


texts: I'm experiencing the duplicate CSS issue mentioned in drupal.org #830382: Unwanted / duplicated temporary css files if CSS Optimization is enabled. In one of my production sites I have about 335 CSS files consuming 3.2M. While this is not a big deal at the moment but certainly not saner to let it grow as such. The site is relatively small and using not more than 10 CSS file. The issue link referred above doesn't seem to have any direction. I would like to hear from the experts here to fix it. Thanks in advance.


texts:
I have a nodequeue named work_order.

If I am in a page which belongs to this queue, is there a way I can get the next node that will be there in the nodequeue?

I looked at most of their API functions, but I did not find one that does this.

I am using drupal 7


texts: How to view "your own comments" without the permission view comments?

texts: In Drupal there is a permission "view comments" and "add comments". I would like to activate "add comments" and disactivate "view comments". How to allow to view your own comments for users? It's a little bit strange to publish comments and they disappear into nowhere.


texts: How to jump to a specific page in a multipage Webform?

texts:
I have a multipage Webform, and I'm using Webform Bonus Pack to display a summary at the end before the user finally submits the form.

What I'd like to do is provide "edit" links alongside the various sections of the form data so the user can jump to the page containing those fields.

Does anyone know how I can do this or, failing that, can anyone at least throw me a bone and tell me how Webform decides which page to display after a "next/previous" button is pressed on a multipage form?

I thought I'd be cute and use Javascript to change the value of the hidden "details[page_num]" field to be one greater than the target page, then invoke a click() on the Previous button, but to no avail; it still goes back to the previous (second to last) page. There is a $_POST['details']['page_num'] containing the current page number, but it's apparently not used to determine where the Next and Previous buttons take the form.


texts: OAUTH2 REST API error: You must set the encryption key

texts:
After getting the token and when I call the rest API I got this error.

  User deprecated function: You must set the encryption key going forward to improve the security of this library - see this page for more information https://oauth2.thephpleague.com/v5-security-improvements/ in League\OAuth2\Server\AuthorizationServer->enableGrantType() (line 142 of vendor/league/oauth2-server/src/AuthorizationServer.php).

The error stack trace is the following.

  League\OAuth2\Server\AuthorizationServer->enableGrantType(Object, Object) (Line: 118)
  Drupal\simple_oauth\Plugin\Oauth2GrantManager->getAuthorizationServer('password') (Line: 50)   Drupal\simple_oauth\Controller\Oauth2Token->token(Object) call_user_func_array(Array, Array) (Line: 123)
  Drupal\Core\EventSubscribe\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 576)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() call_user_func_array(Object, Array) (Line: 153)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
  Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
  Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)   > Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
  Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
  Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

this is the modules that I used:

defuse/php-encryption (v2.2.1)
lcobucci/jwt (3.2.4)
league/event (2.1.2)
league/oauth2-server (5.1.6)
drupal/simple_oauth (2.0.0-rc3)

Any help please?

Note: I use : simple_oauth , league/oauth2-server


texts:
I have two custom content entity types that I've created with a module. Neither one of these content entity types extends Node.

Our site has a search bar, and we want to include these two custom content entity types in the core search results (searching within the name of the entity only).

The only demo I can find on this topic is this, but this doesn't seem to be working for me. I've modified the code to match the identifiers and properties of my custom entity type, placed the code in the module's src/Plugin folder, cleared the cache, but my entity type still does not appear as an option in /admin/config/search/pages. Only Content and Users continue to be available search pages. Additionally I am suspicious that this work for a custom content entity type since I am trying to match search index IDs with entity IDs in the queries within the code, but I think this consistency is only maintained for node entities.

I have also tried following this method of defining a search page through Views, but none of the options this poster has selected are available when I try to make a search page for a custom content entity type (for example "Search" as a filter criteria is not present).

I can't seem to find very much useful info on this topic and am wondering if there are any resources I'm simply missing or misunderstanding.


texts: how to display a gallery of custom themes

texts: I would like to set up a gallery of all my themes and when the user clicks on the item it would go to a pre-setup Drupal instance and it would set that instance with the theme they clicked so they can see the theme in action. I know how to create a photo gallery but i want to have the images when click go to a sub site that is preset to change the default theme to the one passed in the link so that the user can see the live theme. I would like to have one sub site and have that sub site have all the themes installed and simple change the enabled theme based on the request. The user clicking on the images in the gallery will not be logged in. I don't want to make a different site for each theme. That would be to much unneeded work and to many databases that do not need to be. using modules would be the best over making custom code for this.


texts: Drupal 7 form_state[redirect] does not work

texts:
I am new to Drupal development and I stuck on a problem.
I have got a form which I append to a node. The custom submit method is called correctly, but my redirect does not work. When I press the button I got redirected to the form.
Thank you very much in advance

    function ticketGenerator_node_view($node, $view_mode) {
    $nodetype = node_type_get_type($node);
    $nodetype = $nodetype->type;
    if ($view_mode == 'full' && node_is_page($node) && $nodetype=='event') {
    $node->content['buttonKaufentest'] = drupal_get_form('ticketGenerator_generateform',$node);
    }
    return $node;

}

    function ticketGenerator_generateform($form, &$form_state,$node){
    $form = array();
    $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
);
    $form['submit'] = array(
    '#type' => 'submit' ,
    '#value' => 'buttonalter',
    '#submit' => array('ticketGenerator_list_submit')
 );
 return $form;

}

   function ticketGenerator_list_submit($form,$form_state){
   drupal_set_message('custom submit has been invoked');
   $form_state['redirect'] = 'www.google.de';
   }


texts: Drupal 7 image styles ignored by theme preprocess function

texts:
I want to display images at the proper image style-defined size, but there's a problem being caused by a preprocess function written by the person who built this site before I came onto the project.

function abc_field__field_video_thumbnail($variables) {
    $output = '';

    // Render the items
    foreach ($variables['items'] as $item) {
        $output .= "
\r";
        $output .= 'field_video_width['und'][0]['value'] . '" data-popup-height="' . $variables['element']['#object']->field_video_height['und'][0]['value'] . '">';
        $output .= '' . "\r";
        $output .= '' . "\r";
        $output .= "\r\r";
        $output .= "
\r\r";
}

    // Render the top-level div
    $output = '
' . $output . '
';

    return $output;
}

This seems to assume the image style processing would occur before this function happened, but unfortunately it doesn't, and I get a full-size image regardless of image style.


texts:
Simple thing. I have some page (node). At end it produces some content, i.e.

This is original content

I want to alter it with different content, i.e.

This is changed content

So I need a way to collect original content, parse it, replace some part of it and put it back.

hook_ENTITY_TYPE_view() should be the way to do that:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_ENTITY_TYPE_view/8.2.x

And I tried example from that page (by Devendra Mishra) and it works, but it's adding additional content. I need a way to access original content and change it, not to just add new one.

To be clear, I don't want to change content on field level, but want to change final content, with all fields combined, ready to be rendered.


texts: What is the difference between 'Groups audience' and 'Groups content visibility' in Organic Groups Access?

texts: I am trying to set up Organic Groups Access for an existing site where I want to add gated content. I was watching this tutorial about setting it up, and it briefly addressed it. They said that 'audience' is better for sites where you have a bunch of existing nodes. Can someone give me a more technical answer, indicating what exactly the difference is?


texts: Display a view of geolocation fields with lat lon on a google (or equiv) map

texts: I have a geolocation module installed with a field that geolocates and gives a lat lon value. Then I want to use a view of these values to show them in google maps or equivalent. If there is a quick and dirty solution would be good, otherwise I would spend time coding one solution.


texts: How to allow user to use one exposed filter and select between two views

texts:
I am using the search_api module with views as the back-end. Users will have the ability to search through two different kinds of content, and there will be two separate views (one for each content type) to power the search results. I want to expose one search box, but then allow the user to direct those search terms to one view or the other.

Here is a picture that should make my desire more clear:

If the user selects "songbook", then their search gets directed to the song view. If they select "blog", then their search is directed to the blog view. How do I accomplish this using views?


texts: How can I override with my module the existing commerce_file_field_access function?

texts:
I am trying to alter the way commerce_file module shows the product file in the Product display. Actually it is shown to all users owning sort of administrative permissions (such as administer commerce_file or administer commerce_field type).
Its format is:

label: file.pdf

This code is driven by the

commerce_file_field_access($op, $field, $entity_type, $entity = NULL, $account = NULL)

function in commerce_file module itself, it seems.

I would like with my_module to override this behavior to make the file visible to users that doesn't own those permissions but that have already bought the digital product and had license granted for that, but really don't know how to. (I already succeeded in disabling the add to chart button)

I am able to define if the user/buyer already bought it, but just cannot override the module access conditions to apply my rules.
I already tried defining another function like my_module_field_access(), but it doesn't seem to work...

How is it possible to override the hook_field_access() function already defined in commerce_file module?

As an alternative I was minding to replicate/copy that field and render it again without that access control, just in the defined conditions I define in my module.
To do that I tried with a my_module_preprocess_node() function, but didn't succeeded. The new $vars['elements'] is not rendered ...

I hope have been sufficiently clear. really any advice (on the best approach & way) would be very welcome. Wasted so many hours on this ... yet.
Thanks so much


texts: creating a view showing nodes referenced from the currently selected node

texts: I have a content type called shops and another called products. on creating a product content, one can type in the shops name, which is provided as an autocomplete node reference field. what i would like to achieve is to create a view showing products in a selected shop. how can i achieve this. I have tried to use reverse node reference module but its not working for me.


texts: How do I redirect a Read More link to another URL in Showcase Image?

texts:
When creating a showcase image for my homepage, I would like to redirect the Read More link to another page in the site, instead of the default link back to the image.  Is it possible?

Or do I just have to remove the Read More link and insert a URL link inside the slide text?


texts: Failed to update database after upgrading to 8.9.13

texts:
I'm new to drupal and was recently tasked with upgrading the drupal core version of one of our sites. I upgraded from 8.3 to 8.9.13 and everything went smooth enough until it came time to update the database. Here, I was told that two updates had failed.

system module
Update #8501
Failed: Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes: ALTER TABLE {content_moderation_state_field_data} ADD UNIQUE KEY content_moderation_state__lookup (content_entity_type_id, content_entity_id, content_entity_revision_id, workflow, langcode); Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1619 of /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
content_moderation module
Update #8700
Failed: Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes: ALTER TABLE {content_moderation_state_field_data} ADD UNIQUE KEY content_moderation_state__lookup (content_entity_type_id, content_entity_id, content_entity_revision_id, workflow, langcode); Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1619 of /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

The table in question is InnoDB and utf8mb4_general_ci.
Does anyone know what could be causing this issue and how I might go about fixing it?


texts: Setup on GoDaddy / Addon Domain "403 Forbidden Access Error"

texts:
I currently have a working Drupal Commerce site up and running. This site is on a godaddy / cpanel server. This site is on an addon domain and sits in the following server directory:

home/.../public_html/siteX.com

I have the modules / configuration working well and want to use this base code to operate a second Commerce site, primarily to reduce my base code maintenance. (I am fairly new to Drupal and have built two sites for our family's small business. Pretty fun :)

I read a ton about setting up multi-sites that convinced me it would be fairly straightforward. Here's what I have done:

Created a new database on the server. Assigned my "user" to that database with all admin privledges
Created a new directory under the working Drupal Commerce site
home/.../public_html/xxxxx.com/sites/siteY.com
Pointed my "addon" domain to the Document Root above
Copied my default.settings.php into /public_html/xxxxx.com/sites/siteY.com
Renamed to settings.php with the database login information
Set my /siteY.com directory and settings.php to "777" permissions

When I navigate to "siteY.com", I keep getting a 403 error:

  Forbidden
  You don't have permission to access / on this server.
  Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

If I navigate to "siteY.com/install.php, I get a different permissions error msg:

  Internal Server Error

  The server encountered an internal error or misconfiguration and was unable to complete your request.

  Please contact the server administrator at webmaster@ to inform them of the time this error occurred, and the actions you performed just before this error.

  More information about this error may be available in the server error log.

  Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Is it an issue to create a multisite from an add-on domain?
What am I missing here?
Should I jump ship and use the "Domain Access" module?


texts: How to create main links like home ,services programatically?

texts:
I am creating a new website in Drupal 7,but from my past efforts I tried adding main menu links(home,services,clients,blog etc)but all in vain!!

Can anyone tell me how to create main menu links programmatically or through admin interface?


texts:
I am having a lot of trouble understanding what is wrong with my code. I am trying to create a custom Facebook block, utilizing the Facebook Graph API. My module works to the extent that I see some posts show but the following is taking place:

1) The posts duplicate. This does not happen when recreating the feed outside of a drupal module.

2) Output of Block content is outside of any region and loads at the top of the page.

Here is the code I am using:

/**
 * Implementation of hook_block_info().
 */
function mymodule_block_info() {
  $blocks = array();
  $blocks['facebook_block'] = array(
    'info' => t('Facebook Block'),
  );
  return $blocks;
}

/**
 * Implementation of hook_block_view().
 */
function mymodule_block_view($delta='') {
  $block = array();
  switch ($delta) {
    case 'facebook_block':
      $block['subject'] = '';
      $block['content'] = facebook_main_contents();
      break;
  }
  return $block;
}

function facebook_main_contents(){
require_once('resources/facebook-php-sdk-master/src/facebook.php');

// connect to app
$config = array();
$config['appId'] = 'MYAPPID';
$config['secret'] = 'MYSECRETID';
$config['fileUpload'] = false; // optional

// instantiate
$facebook = new Facebook($config);

// set page id
$pageid = "MYPAGEID";

// now we can access various parts of the graph, starting with the feed
$pagefeed = $facebook->api("/" . $pageid . "/feed");

echo "
";

// set counter to 0, because we only want to display 10 posts
$i = 0;
foreach($pagefeed['data'] as $post) {

    if ($post['type'] == 'link' || $post['type'] == 'photo') {

        // open up an fb-update div
        echo "
";

            // check if post type is a link
            if ($post['type'] == 'link') {
                echo "
" . $post['message'] . "
";
                echo "
";
                echo "

";
                echo "
" . $post['name'] . "
";
                echo "
";
                echo "
Posted on: " . date("jS M, Y", (strtotime($post['created_time']))) . "
";
            }

            // check if post type is a photo
            if ($post['type'] == 'photo') {
                echo "
Photo posted on: " . date("jS M, Y", (strtotime($post['created_time']))) . "
";
                if (empty($post['story']) === false) {
                    echo "

Story
" . $post['story'] . "
";
                } elseif (empty($post['message']) === false) {
                    echo "

Message
" . $post['message'] . "
";
                }
                echo "
View photo &rarr;
";
            }

        echo "
"; // close fb-update div

        $i++; // add 1 to the counter if our condition for $post['type'] is met
    }

    //  break out of the loop if counter has reached 10
    if ($i == 5) {
        break;
    }
} // end the foreach statement

echo "
";
}

I have tried placing my content code in a separate php file and including it, but that just breaks everything.


texts: Conflict between with a function in two different modules

texts:
I have the same function in two different modules to change the page: node/add.

I need the second one(see below) to override the first one. I implemented hook_install to change their weight but is not working. My guess is that the hook_install function is executed after those modules.

How can get this done?

Codes below:

My hook_install function

/**
* Implements hook_install().
*/
function utilities_install(){

db_update('system')
    ->fields(array('weight' => 10000))
    ->condition('name', '[content_type_thumbnail]', '=')
    ->execute();

}

Function in commerce_backoffice_product module:

 /**
 * Implements hook_theme_registry_alter().
 */
function commerce_backoffice_product_theme_registry_alter(&$theme_registry) {
  $theme_registry['node_add_list']['function'] = 'theme_commerce_backoffice_product_node_add_list';
}

/**
 * Override node_add_list theme.
 */
function theme_commerce_backoffice_product_node_add_list($variables) {
  $item = menu_get_item();

   .... code ....

  return theme_node_add_list($variables);
}

Function in content_type_thumbnail module

/**
 * Implements hook_theme_registry_alter().
 */
function content_type_thumbnail_theme_registry_alter(&$theme_registry) {
  $theme_registry['node_add_list']['function'] = 'content_type_thumbnail_node_add_list';
}

/**
 * Override of theme_node_add_list().
 */
function content_type_thumbnail_node_add_list($variables) {

  .... code ....

  return $output;
}


texts:
How can i perform code review with coder_review command in a specified folder?
I see that i can give it contrib or core directives, but i would like to only check a folder in my modules folder like

/modules/dev

/modules/contrib/

/modules/custom/

How should i instruct coder-review command to check those modules (custom) only?

Tried drush coder-review <folder-path> that doesnt seem to work, is there any other option, or should i patch the module to accept my 'custom' directive?


texts: How do I programmatically update a UUID?

texts:
Reason: Receiving uid does not exist error. Upon investigating, this error appears only when we edit or save the preexisting columns paragraph. If we create new columns paragraph, the error doesn't appear as the uuid is different for the newly created columns paragraph.

This is the reason to update the uuid for a paragraph that is referenced on that page. In my custom module I have loaded all nodes using entity query below and loaded the referenced paragraph.

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'page')
  ->execute();
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);

  foreach ($nodes as $n) {
   //Relevant apragraph for the content type
   $para = $n->get('field_page_content')->getValue();
   $para_2 = $n->get('field_banner_image')->getValue();

   foreach($para as $e){
     $p = \Drupal\paragraphs\Entity\Paragraph::load($e['target_id']);

    if($p->bundle() == "columns"){
      kint($p,'Paragraph Entity');
      kint($p->uuid(),'Paragraph UUID');

       $uuid = 'd12da227-890b-4eb7-86b1-93937e7d6d91';

       //save paragraph
       //$p->save();

    }
  }
}

How can I get this updated without recreating the columns paragraph as there are quite a few.


texts: Is it safe to purge the /files/styles directory?

texts:
I use Image Styles to automatically generate thumbnails (for teasers and views). I have a lot of images, so I end up with a lot of cached thumbnails in the /files/styles directory.

Is it safe to delete the contents of /files/styles without doing anything like clearing the cache in Drupal? My hope is that the thumbnails would be regenerated as needed without issue.


texts: Is it possible to include countdowns in nodes?

texts:
I need to include countdowns in nodes of a particular content type

I looked around but couldn't find a countdown module that allows simultaneous active countdowns.

Any ideas, suggestions are welcome


texts: Cloning a live/production site to a test/development version

texts:
I am administering a drupal 6 high traffic, high user base website and I would like to have it cloned into a development version in order to test modules before deploying on live.

I am unable to find anything related to this, no matter how hard I try.

What are the implications of cloning a live site into a test version on another server?

What aspects should I have in mind when doing this?
e.g. avoid user notifications via email from test server

Thanks!


texts: How do I style the login form in the zen sub-theme neptune. I'm kind of confused if I'm supposed to override the css styles. I'm not able to figure out how to change the login form wrapper div and the styles inside it.


texts: Single quote in in filter return exception querySelectorAll

texts:
I face a problem when filter with single quote in field.
Anyone know why? And how to disable this exception?


texts: How to create a google map block to display number of nodes for a content type

texts:
I have a content type "Houses".

I added 3 nodes as follows.

Node 1 for county X and state A
Node 2 for county X and state A
Node 3 for county Y and state B.

I like to create a google map block which will show 2 in County X in google map and 1 in County Y section in google map.

Below is an example

Google doc

Update 1

https://docs.google.com/document/d/1q9uLBQpWY_a3du6HbWH3s0Gz2k_F4gJDYQDpeX9mcaw/edit?usp=sharing


texts: Changing the module path on custom install profile

texts:
I would like to have the profile install the modules I list in my profile .make to sites/all/modules/contrib instead of in the profile directory profiles/my_sweet_profile/modules/contrib is there any way to do this without having to use a script to copy the modules, and then rebuilding the drupal registry?

I have read this DA post, but the answers contained pertain to the more canonized distribution profiles (OpenAtrium). I am not going to be rerunning this installation profile on the same site, so there is no need for me to preserve the initial structure.

Thanks!


texts: How to override controller of other modules?

texts:
Let's say in /var/www/drupal8/core/modules/search/src/Controller/SearchController.php
below is the snippet

class SearchController extends ControllerBase {
     ...
     ...

  public function view(Request $request, SearchPageInterface $entity) {

       ...
       ...
      if (count($results)) {
         $build['search_results_title'] = array(
        '#markup' => '
' . $this->t('Search results') . '
',
       );
     }
      ...
   }
}

So  in the above snippet I want to change the text Search results in line

'#markup' => '
' . $this->t('Search results') . '
',

I want to override above view method extending class SearchController in my custom module.

What are the exact steps to do this?

I am using drupal 8.2.1.


texts: Views aggregation plus group by monthly and calculate average

texts: is there any ideas to group by monthly and calc month average temptature ? I using Views Aggregator Plus-module for this. Example below


texts: How to make the Charts module use the Highcharts legend option "useHTML" (required for RTL)?

texts:
I tried using the Charts module with Highcharts as my charting library (engine). And this for a block view in a multilingual site that flips between LTR and RTL.

I found out that the legends and tooltips break in RTL. The legends labels overlap the colored boxes and the text within the labels is pushed outside of the tooltip box.

I managed to make the tooltips presentable through the use of $chart['#tooltips_use_html'] = TRUE; (in 'chart_alter'). Although the text is aligned wrongly the out of box issue disappeared.

However I found no similar option for the legend. I looked at the Highcharts documentation where I found a useHTML option for fixing this issue with legends. But I am unsure about how to apply it with the hooks provided by the Charts module.

Here is a picture of it:


texts: Linux distribution suited for a clean and easy Drupal 8 install

texts:
I am experiencing a series of issues trying to prepare a server on my professional environment for running Drupal 8. By default, the IT team will install CentOS 6. More precisely, we are running CentOS 6.7.

The issue here is that the default versions of PHP and MySQL on that version of CentOS won't match the minimum required versions for running Drupal 8, which requires us to use repositories. As we are not Linux ninjas, we are facing several problems with the repos. I have two versions of libmysqlclient on the system, but the system will only 'see' the old one which doesn't support the MySQL version required by Drupal. The thing is really getting cumbersome.

So my next approach would be to suggest the IT team to go with the ideal Linux distribution which wouldn't require us to use the repositories, one that can deliver the cleanest install of PHP, Apache, MySQL, phpMyAdmin and Drush.

Based on your experience installing Drupal 8 on Linux servers, what is your preferred setup (Linux distribution), requiring minimum effort from server administrator, to install the appropriate versions of PHP, Apache, MySQL, phpMyAdmin and Drush that will work 'out of the box', discarding the use of custom repos? Thanks in advance.


texts:
Something within my site is generating a request to a css file called "none". It is using the path of our theme. Our theme does not have any such style sheet called as part of our stylesheets array.

Our definition:

stylesheets[all][] = css/mods.css

stylesheets[all][] = css/main.css

request on page load:

/sites/all/themes/our_bootstrap/css/none

Since there is no such file, a 404 is served for that file. Where can I look to track down what is generating the request?


texts: How to insert a view in the body field of a node?

texts:
Is there any way to insert a view in the body field of a node?

Something similar to the insert module for inserting images in the body field.


texts: On a content page that references a taxonomy term, how can I display only content that references that taxonomy term's immediate children?

texts:
In Drupal 8, I have a hierarchical taxonomy vocabulary called "Living Things" containing these terms:

Animals
--Fishes
----Blennies
------Yellow Blenny
------Green Blenny
----Gobies
------Blue Goby
------Red Goby

I have created a custom content type called "Taxon Page" which includes a single reference to the "Living Things" vocabulary.

Using the "Taxon Page" content type I have created a page for each of the terms in the "Living Things" vocabulary. So for example, my "Yellow Blenny Facts" content page contains a reference to the "Yellow Blenny" taxonomy term.

On those "Taxon Page" content pages, how can I display only content that references that taxonomy term's immediate children (if there are any)? For example, the "Fishes Facts" content page should display data from the "Blennies Facts" and "Gobies Facts" content (not just a link to those taxonomy terms), but not their children.

I have tried to achieve this by creating a view for "Content type (= Taxon Page)" and adding a "contextual filter: Content: Has taxonomy term ID (with depth)" (depth of 1) but it did not work.

Note that this question is related but different, as it only refers to taxonomy terms, not content referencing those taxonomy terms.


texts: The admin/content page only shows the Delete button for nodes; missing edit and view

texts:
I have created a role in D8 with permissions to add/edit/delete any content type, even if its not their own. They also have the blanket "Administer Content" permission.
When they view a node, they see the tabs to Edit, Delete, Revisions, etc., and are able to act accordingly without issue.
However, when viewing the admin/content overview page, the only button available underneath the "Operations" column is the delete button. When they click the title of the node and go to view it, they can edit it from there without issue.
I've attached a screenshot with some info blocked out.


texts:
Can  you help me please with node form in the Drupal 7?

I have a three forms (node/add/A, node/add/B, node/add/C).
Values in the node/add/A are created after registration.

How to display a values with node/add/A to the node/add/B like default values a field?

Sorry for my English.
Thank you everyone for your help


texts: Passing current node ID to the block template

texts:
I have a module with a custom block MyCustomBlock.php that get the nid of the current page and pass the value to the block template:

$node = \Drupal::routeMatch()->getParameter('node');
$nid = $node->nid->value;
return array(
  'currentnid' => $nid,
);

Inside the template I print the passed value {{ currentnid }}, but it only works cleaning the cache! For example, if I load the page with nid 5 it prints 5, but if I move to page with nid 3 it prints 5. Cleaning the cache and reloading page with nid 3 I get the value 3 printed. I think it is a problem with the template caching system in D8, do you have any idea about this?


texts: How can you hide modules form all listings without deleting them

texts: I have a growing collection of modules on site.  My module management page and on my feature management page are starting to get cluttered (even with module filter enabled.)  Several of these modules are example modules which are disables and currently only serve to clutter things up.  I would like to hide these modules so that they do not appear in any of my module  lists.  I don't want to delete them (or alter their code if possible.)  Is there a way to temporarily hide a module so it does not appear in any of the module lists?


texts: Create a block with articles from the current edition

texts:
Hello I need to create a block that when is on the article page to show all the related content from the edition it belongs.

I tried with views but the problems comes from the fact I cannot add a filter of the current edition.

I think this should be done within a module but I needs some clues. Thanks.


texts: having a backup of 'sites' folder and database backup is all I need?

texts: I'd to be sure that having a backup of 'sites' folder and database backup is all I need to restore a site?


texts: Hide status messages generated from Commerce - Not required with use of Ajax add to cart module

texts:
I am using a nice little module Commerce Ajax Cart which adds products to the cart without a refresh.

However, my only little issue is that when then navigating to the checkout page, it displays all the status messages for the products that have been added to cart.

I could hide these with CSS using the status class, however, this could also hide any important status messages with it.

So my question is, how can I hide the status messages from commerce, or if anyone knows where these status messages are being generated from within the commerce modules.

Thanks


texts: How to create multiple slideshows on my front page?

texts:
I am new to Drupal and I don't know how can I create multiple slideshows on my front page.

I am developing an image sharing website where users will upload their images. I want that when a user adds a gallery a slideshow is made on the front page. Like if I have four users means I will give four different slideshows on the front page.

Any help?


texts: How do I add a custom validation handler to an existing form/field?

texts:
How do I add a custom validation handler to an existing form (or form field) in Drupal 8?

I have a form that I haven't created. I want to add my own validation rules on some fields when the form is submitted.

For Drupal 7, Custom validation for a form? explains to implement hook_form_alter() and then add your validation handler][1] to the $form['#validate'] array, but in Drupal 8 forms are classes. Validation is done through the validateForm() method and I don't know how to plug my code into that.


texts: Webform 5.x lookup validation via data table lookup

texts:
I want to block/validate a new entry based on another submitted form

e.g.

If a site number has been used I want to block any new entry that wants to use that number?

Is this possible?

If so How?

Thanks all


texts: Radioactivity and Rules- difference between "add an incident" and "set the energy"

texts:
I want to increase the radioactivity level after flagging the node.
But I don't know exactly how to set the value.

If I fill in the value form field with 60, the Radioactivity text field will increase over 200.

So maybe the action settings are wrong.
What is the difference between the following actions?

add an incident to a field
set the energy of a field


texts: Show Targeted Content Based on Content Field and User Roles

texts:
I'm looking for a way to show specific targeted content based on a content type's field and user role.

For example, if user1 has a "Content Group 1" role, then the view should show content pieces with "field_content_grouping" == "Content Group 1". User2 having a "Content Group 2" role should only be able to see "Content Group 2" and so on. Both roles & field values are exactly the same.

I'm looking for the best way to properly execute this. I've seen people do similar things with pre-render for views or views query alter hooks. My general line of thinking is:

Before rendering views get User roles: Loop and check roles against a specific field "field_content_grouping" - if there is a match, continue else unset node from view.
Return full results (sans content pieces without a matching field &
role).

What's the best way to accomplish something like this? Or am I completely on the wrong track all together? Any and all assistance is greatly appreciated, thanks!


texts: Advanced forum topic list pagination settings is not applied

texts:
I tried to change the pagination settings (number of elements displayed) in the view corresponding to the topic list, but in the front end, this setting doesn't seem to be applied.
the original value was 20 elements displayed, but the value really applied is 25.
Does anybody know why is that and how can i set this setting properly ?


texts:
I need to save this to database, but could not find a way to make it work.
Now this paypal_email is only saved to current user. Apparently it is saved somehow to the database under user table, but it can not be read there? Or use views to read it.

function commerce_funds_manage_withdrawal_method_paypal($form, &$form_state) {

  $enabled_methods = variable_get('commerce_funds_withdrawal_methods', array());

  if (!$enabled_methods['paypal'])
    return FALSE;

  global $user;

  $form['paypal_email'] = array(
      '#type' => 'textfield',
      '#title' => t('Paypal Email'),
      '#description' => t('Withdrawals using Paypal will be sent to this email'),
      '#default_value' => $user->data && array_key_exists('paypal', $user->data) ? $user->data['paypal']['paypal_email'] : '',
      '#size' => 40,
      '#maxlength' => 64,
      '#required' => TRUE,
  );

  $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
  );

  return $form;
}

function commerce_funds_manage_withdrawal_method_paypal_submit($form, &$form_state) {

  global $user;

  user_save($user, array('data' => array('paypal' => $form_state['values'])));
}


texts: Drupal Commerce and Commerce Multicurrency

texts:
How do I change the currency of the checkout using a rule?

Currently I have the shop changing the price of a line item based on region/language and with this changing the currency. It works well in switching the price of the line items and the overall total, using a couple of rules.


texts:
I'm trying to import images, but why does migrate_tools swear on my yml file when I try to migrate.

id: migrate__articles_teaser_images1
label: 'Migration teaser images of article'
migration_tags: null
migration_group: test

source:
  plugin: migrate__json
  module: migrate
  path: assets/articles.json
  columns:
    0:
      key: id
      label: 'Id'
    1:
      key: photo_name
      label: 'Photo name'
  key: id
  constants:
    file_source_uri: public://import/program
    file_dest_uri: 'public://program/image'

process:
  file_source:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_source_uri
        - photo_name
    -
      plugin: urlencode
  file_dest:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_dest_uri
        - photo_name
    -
      plugin: urlencode
  filename: photo_name
  uri:
    plugin: file_copy
    source:
      - '@file_source'
      - '@file_dest'

destination:
  plugin: entity:file

I do not quite understand how the URI is organized and why need to write "public: // ...", but at the root of my site there is an import / program folder that contains images (to which I refer from sources) for later copying .

My json file:

[
  {
    "id": 523,
    "title": "Love Is Strange",
    "photo_name": "1.png",
    "author_id": 3,
    "alias": "love_is_strange",
    "categories_ids": [
      {
        "category_id": 2
      },
      {
        "category_id": 1
      }
    ],
    "teaser_text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
  }
]

That is, there is a file 1.png in my import/program folder. But still my code does not work, help me find the error.


texts:
I have a site built in Drupal 7.23, which is supposed to handle large files uploads to it.

I have a node form with 5 File upload fields which is supposed to take 200MB files for each.

What should be the Apache server adjustments that i need to taken in favour of making the upload process seamlessly?

Also i have Video module with FFMPEG configured to convert on cron. Someday I got message form server support team that my FFMPEG is taking 100% CPU.

Also i got some MySQL errors, like Lock TimeOut etc. what to do ?

Please let me know an optimal settings for these kind of server which runs Drupal.


texts: how to get list of all route in routeProvider?

texts:
I have:

class MyRouteProvider extends DefaultHtmlRouteProvider {
    public function getRoutes(EntityTypeInterface $entity_type) {
        $test = parent::getRoutes($entity_type); // TODO: Change the autogenerated stub
        // how do i get list of route that i have in this method?
    }
}

how do i get list of route that i have in getRoutes method?

what i'm trying to do here is: I like to search a particular route (based on $entity type) that created by my_entitiy and modify it.


texts:
How do I go about creating a similar content-structure as wordpress.com?

I want the user experience to only be of the sub-site (sub-site.example.com) and not of the main website (example.com). E.g. the home link goes to the sub-site, like this http://fiveandspice.wordpress.com/
In my case I will not offer blogs, but a web-application.
I'm thinking of utilizing Drupal for the user-system to handle the subscription-based accounts and generating the web pages.
The account-owners will have visits to their "page", and those visitors in turn would as well need account to do certain actions. Similar to how Basecamp work.


texts:
Using XAMPP on Mac

I have installed https://www.drupal.org/project/smtp

After setting up admin/config/system/smtp

It gives above error. Unable to send test email.

Do we have to any setting on gmail or i'm missing anything?


texts: what is use of $title_prefix and $title_suffix variable inside drupal theme system

texts: i am intermediate in php.i start learning drupal 7 theme system. i need to know what is role of  $title_prefix and $title_suffix variable inside .tpl.php files. what happen if we not include these variable inside .tpl.php files. i also read documentation for those variable at drupal.org but documentation is not enough to make it crystal clear.can anybody explain its use in simple words.


texts: How to alter combined filter value programatically?

texts:
When taxonomy terms are combined, the values searched are term id instead of term name. So I tried to alter the query using views_query_alter. But it seems the values are coming from object.

function MYMODULE_views_query_alter(&$view, &$query) {
 if ($view->name == 'my_view') {
   if (is_object($query->where[1]['conditions'][0]['field'])) {
     foreach ($query->where[1]['conditions'][0]['field']->conditions() as $key => $value) {
        if (is_numeric($key)) {
          $possible_terms[] = $value['value'][':views_combine'];
        }
      }
     // here i was planning to load the term id from the partial
     // term search key from combined filter
     // once the term is identified, i would like to update the query.
   }
 }
}

The problem is $query->where[1]['conditions'][0]['field']->conditions() is a function and I don't know how to substitute value to it.


texts: How do I programmatically change the node default language?

texts:
I have a node already translated in 3 languages (en, fr, es) with en being the default language. and I want to change it to fr. I looked around and I found setDefaultLangcode() (protected).

Is there a way to programmatically change it?


texts: How to show another text if field val 0?

texts:
{% for item in items %}
    {% if item.content %}

balance

Yes {{ item.content }}

    {% else %}

balance

Nope

    {% endif %}
{% endfor %}

My field is integer.
I try all if (is null, is same as, etc...) but nothing works.


texts:
I am working on trying to understand the secrets of custom-developed blocks. Namely, I have a use case where a block need to pull content via EntityFieldQuery (this could be done with Views, but I like a challenge) and the contents loaded need to adjust based on a URL argument.

Right now my running assumption is that since the page that will deliver these results is run through Context, my best bet for getting values from the URL are through arg() when the block is generated inside its referencing callback from hook_block_view(). I just want to be sure this is the best approach to actually load values that must be passed in through this approach, and i'm not missing a more reasonable design pattern.

Code example is below.

/**
 * Implements hook_menu
 */
function widgets_and_springs_menu() {
  $items['springs/%'] = array(
    'title' => t('All Springs for Category'),
    'page callback' => 'widgets_and_stone_blank_page', //Returns theme of '', enough for Context to catch
    'type' => MENU_LOCAL_TASK,
    'page arguments' => array(1),
  );

  return $items;
}

/**
 * Implements hook_block_info()
 */
function widgets_and_springs_block_info() {
  $block['springs_listing'] = array(
    'info' => t('All Springs Per Category'),
    'cache' => DRUPAL_CACHE_PER_ROLE,
  );

  return $block;
}

/**
 * Implements hook_block_view()
 */
function widgets_and_springs_block_view($delta = '') {
  $block = array();

  switch($block) {
    case "springs_listing":
      $block['subject'] = "";
      $block['content'] = widgets_and_springs_get_results_by_uri_arg();
  }
}

/**
 * Returns arguments by URL. First item MUST contain a TID argument.
 */
widgets_and_springs_get_results_by_uri_arg() {
  $searchTid = arg(1);
  //Other stuff & Return of results within theme()...
}


texts:
I have a content type "basic".

That content type is using 3 taxonomy vocabularies.

Vocabulary 1 - 5 terms
Vocabulary 2 - 3 terms (term1, term2, term3)
Vocabulary 3 - 6 terms

I have a view that displays all the content from this content type. There are three exposed filters for the three vocabularies, they are displayed as a exposed filter block top of the content and they are working great.

From a left side I have menu links that show the three terms of Vocabulary 2 and it looks like this:

Term1
Term2
Term3

Now the problem is if I select Term2 menu link that shows the content related to that taxonomy term and use some of the exposed filter, there are no results displayed.

I mean I'm selecting a menu link Term2 from left and than I check some term, lets say from the third exposed filter and the result is nothing, even if there's a content that belongs to that term.

Is it possible that menu to not interfere the filter results?


texts: How do I use a jQuery version different from the default one used by core?

texts:
I need to use a different jQuery version. Currently, Drupal is using jQuery 3.2.1, but I need a previous version.

In Drupal 7 you could easily change jQuery version with the jQuery Update module. How can I achieve the same with Drupal 8?


texts: Memory Size issue is coming while we have increased a lots of Memory

texts: Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 71 bytes) in /home/public_html/includes/theme.inc on line 98


texts: Can I do a scrollable calendar/events listing with a Drupal module?

texts:
I have the FullCalendar module installed, and it's pretty easy to use that to put a little calendar display in a block (making it look good is another matter).
But can I use it to make an events display like the one on Metromix?
(Sorry, I guess I'm too new to post an image! Please see the link above)

I can make FullCalendar display a week's worth of events, but that's not really what's happening here.  As you can see in the example, the user can scroll left or right to get different days to display, have a particular day in the list selected, and have that selected day's events displayed below.  Those are the parts that aren't clear how to do with FullCalendar (if it's possible at all).

Can FullCalendar do this?  Is there another module that can do this?  Or do I have to do this kind of thing by hand?

Thanks in advance for any pointers!


texts:
I try to add  Poll-voting to my website, on page I addet 5 votings forms, I try to make submission of all 5 forms by one click instead of 5 clicking. I wrote this script :

 <script language="javascript" type="text/javascript">
      function submitDetailsForm() {
           $('#poll-view-voting').submit();
       }
 </script>

But this code submit first form only(the forms has one id).
Console.log retrieve this:

[form#poll-view-voting, context: document, selector: "#poll-view-voting", init:  function, jquery: "1.4.2", size: function…]
0: form#poll-view-voting
context: documentlength: 1
selector: "#poll-view-voting"
__proto__: Object[0]

How i can solve this issue, help please. I am new in Drupal 7 and JS.


texts: How to write page.tpl.php file for bootstrap site

texts:
I have the below code in the page.tpl.php file.

<header id="navbar" role="banner" class="<?php print $navbar_classes; ?>">

      <?php if ($logo): ?>
      <a class="logo navbar-btn pull-left col-xs-12 col-sm-12 col-md-2 col-lg-2" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
        <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />

      <?php endif; ?>
............

As you can see, I have written bootstrap class col-xs-12 inside a class:

<a class="logo navbar-btn pull-left col-xs-12 col-sm-12 col-md-2 col-lg-2" ....

Then I uploaded an image whose original size is 658 x 318 (Appearance > bootstrap sub theme > Logo image ).

When I visit my using in mobile phone, I still see the logo in original size. I thought me adding col-xs-12 will instruct bootstrap to fit the image in 12 column grid system of my mobile screen. Do you know why image is still in original size even though I added the bootstrap class col-xs-12?

#Test1 - Passed

In tpl file > header region > I have added img-responsive class:

">

      <?php if ($logo): ?>
      <a class="logo navbar-btn pull-left col-xs-12 col-sm-12 col-md-2 col-lg-2" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
        <img src="<?php print $logo; ?>" class="img-responsive"  alt="<?php print t('Home'); ?>" />

      <?php endif; ?>
.....

After that, I have uploaded the logo (appearance > bootstrap > Upload image...). When I view the page in mobile, I see that image was responsive. This is good.

#Test2 - Failed

In tpl file > main container region > I have added img-responsive class:

/** I have added this for all the images to be responsive for main contents */

    <?php if (!empty($site_slogan)): ?>

<?php print $site_slogan; ?>

    <?php endif; ?>

    <?php print render($page['header']); ?>

    <?php if (!empty($page['sidebar_first'])): ?>

        <?php print render($page['sidebar_first']); ?>

    <?php endif; ?>

............

After that, I uploaded some images to content types. When I view the node in mobile, I still see those images in original sizes. How do I update the tpl file so all the images in main container class become responsive as well?


texts: Private tempstore storage contains data for previous anonymous user

texts:
I have an issue with private tempstore storage that I wasn't able to solve. I've implemented a webform handler, which populates data in this storage and then I'm creating tokens out of the saved values. This works fine, however, when anonymous user comes to page where token value is used, he/she sees last value saved in to the storage, before his/her session has been created.
This is strange, because setting a value for anonymous user should create a session for user, if it doesn't exist, yet: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TempStore%21PrivateTempStore.php/function/PrivateTempStore%3A%3Aset/8.6.x Do you have any idea why this happens, please? Should I use module https://www.drupal.org/project/session_based_temp_store? Should I consider using Sessions directly (https://drupal.stackexchange.com/a/246268/7580)?


texts: What is the Features specific data in a Features module's .info file

texts:
I'm not sure if this is a Features module question or simply a module construction question.

I have a module which was constructed with Features, which I have never used before. In the .info file of the module there are a lot of lines that read similar to features[something][] = something.

What is this and where is it used in the module?


texts: Testing the value of Fields stored on Taxonomy Terms

texts:
I have a field (called Division) attached to a node. I want to print out a link (called Switch) on page.tpl.php that varies according to the value of this (node-based) field.

I can successfully do this with the following code:

In template.php

function elite_field_division_helper(&$variables) {
  if ($node = $variables['node']) {
    $field_division = field_get_items('node', $node, 'field_division');
    if ($field_division[0]['tid'] == 1) {
      $variables['switch_site'] = 'Visit Our Business Website';
    }
    else if ($field_division[0]['tid'] == 2) {
         $variables['switch_site'] = 'Visit Our At Home Website';
    }
  }

}

In page.tpl.php

<?php if (!empty($switch_site)):?>
  <?php print $switch_site; ?>
<?php endif; ?>

My question is: How can I get this code to work with fields that are attached to TAXONOMY PAGES? (As Drupal 7 allows taxonomy pages to have fields).


texts: Applying CSS to sub theme created by Omega

texts:
I am creating responsive theme. To create a theme I have created subtheme of Omega theme.

Until the creation of subtheme every thing was easy. Now after creating the subtheme I want to apply the CSS provided by the designer. But the problem is that designer has created different class name and div tags than Omega.

I am stuck now, I don't know from where should I start ?

What will be the best practice in such type of cases when subtheme and CSS provided by the designer has different class and divs


texts: Deploying code to multiple front end servers

texts:
We have a situation where we have multiple load balanced servers pointing to a common database.

In the normal run of things this works fine and gives redundancy, scalability etc.

However we are finding deployment to be a bit of a chore.

We are using features extensively and are trying to automate deployment. Deployment at the moment is not very reliable.

In a simplified form the deploy script for each server has two stages

Update Files
Revert Features (which
will manage dependencies, settings
changes etc)

Are there any best practices for deploying across multiple servers without causing them to be in an inconsistent state?

As far as I can see if you deploy steps 1 and 2 to server A it will cause server B to break, if you try step one on both servers before proceeding to step 2 they will both be broken for a while.


texts: Custom permission always denying access?

texts:
In my module:

function mymodule_menu() {
    $items['reports'] = array(
    'page callback' => 'reports',
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content', 'hr functionality')
    );
    return $items;
}

function mymodule_permission() {
  return array(
    'hr functionality' => array(
      'title' => t('HR functionality'),
      'description' => t('Do things only HR are allowed to do.'),
    )
  );
}

I set HR to have "HR functionality" permissions. I logged in as a user with HR role, and I get access denied to my reports page. I tried clearing cache, etc. If I remove the "hr functionality" access argument it lets me in.

Even if I log in as admin, I get access denied.

What am I doing wrong here?

EDIT: The method I ended up writing per accepted answer:

function multiple_permission_callback() {
    global $user;
    $permissions = func_get_args();

    if (empty($permissions))
        return false;

    foreach ($permissions as $permission) {
      if (!user_access($permission, $user)) {
        return false;
      }
    }
    return true;
}


texts: How to print url arguments in headers view

texts:
I have a View and inside it I have and Attachment display. In this attachment I set a Header where I need to print the 2nd url argument. How can I do this? With globals?

Thanks


texts: Devel dsm() function in Drupal 8 page.html.twig

texts:
Is Devel module's dsm() function available in page.html.twig? If it is not available, is there a way to make it available?

I am able to use dsm() in .theme file but not in page.html.twig.

I am aware of dump() function in .twig. dump() is similar to var_dump() of php and the output is not as clean as Devel module's dsm() function.

Using dsm() or dpr() in page.html.twig causes error and site does not load.


texts: Make new content [typeA] out of existing content [typeB]

texts:
I have an event management site I am trying to build (which is using the COD framework) but I am trying to work my way around a functionality setup.

The basic principle is that an Event will be created, this will be published to the main page of my site and invite delegates to submit an Abstract for the Event in order to present their topic. The Abstracts will be scored internally and the selected ones will be marked to become actual presentations. The Event information will contain a Programme page, which is just a list of the presentations. Once the event has taken place, they want to be able to sell the video of the presentation.

What I wanted to achieve is outlined in steps:

Event is setup by admin, but has no programme information
Users submit an abstract (which has an entity reference to that Event)
When an abstract is chosen to be presented, the important information is copied into an 'empty' product, ie: Status is set to unavailable and price to 0, but the product display for that product becomes the Presentation
Programme is a list of all Presentations (product displays) for that Event
After the Event has finished, a price and an asset are added to the product, which is then set to available, so that it shows up in the shop

This process is already in place in my site as it is, but the client is wondering if they can effectively remove another step from this process. They are looking to automate the process so that they don't have to copy information from the Abstract, into the empty Product

My approach to this was to add a 'selected' checkbox to the Abstract content type, then create a rule which would then check every time the content was saved to see if this checkbox is set to 'approved', *then create a new product from the information already within the Abstract

My problem is I am getting stuck when it comes to where my * is, I don't even know if it's possible to copy all of the information from one content type into a new one of another. Can this be done, or am I going to have to find another way around or custom code it etc?

Kind regards


texts: How to pass Javascript variable with form on submit?

texts:
I want to pass a variable created with Javascript to $form_state so that I can use this variable in the form_submit function.

In an ajaxified form I can use:

Drupal.ajax[ajax_el].options.data._my_vars = JSON.stringify(js_object);

But how can I accomplish it in a non ajax form? Is there another possibility than using a hidden field? It might be possible to pass it to a field with #access => FALSE?

I would welcome every advice. Many thanks!

Daniel


texts:
my array for $var gave me the following $var dump

stdClass Object

    (
        [vid] => 71
        [uid] => 1
        [title] => dr1
        [log] =>
        [status] => 1
        [comment] => 1
        [promote] => 1
        [sticky] => 0
        [nid] => 71
        [type] => doc_upload
        [language] => und
        [created] => 1378359025
        [changed] => 1378359025
        [tnid] => 0
        [translate] => 0
        [revision_timestamp] => 1378359025
        [revision_uid] => 1
        [body] => Array
            (
            )

        [field_upload] => Array
            (
                [und] => Array
                    (
                        [0] => Array
                            (
                                [fid] => 59
                                [display] => 1
                                [description] =>
                                [uid] => 1
                                [filename] => drupal-7.23.zip
                                [uri] => public://documents/drupal-7.23.zip
                                [filemime] => application/zip
                                [filesize] => 3646168
                                [status] => 1
                                [timestamp] => 1378359025
                            )

                    )

            )

i need to take the value of [uri]... (indicated above) in a variable. Plz help


texts: How to insert a new tag with chosen module ?

texts:
I installed the chosen module and its library on my site drupal 7.

I created a custom field in a content type to enter tags (words) within the vocabulary (taxonomy).

Everything is working correctly for the selection of tag between those in vocabulary, but I can not insert new tags if they do not exist.

Any help ?


texts: I am trying to update the reCAPTCHA module (which is installed on sites/all/modules) in Drupal 7. I could see other 3 modules which have pending updates. Is it possible to individually update each module using update.php?


texts: Load ajax events view based on calendar block click

texts:
I have configured Calendar module for event listing, I have a mini calendar block that when clicked should load the events views without refreshing the page.

$("#block-views-calendar-block-1 .mini.has-events a").click(function(e){
          e.preventDefault();
          href = $(this).attr('href');
          console.log(href);
          $.ajax({
          url: Drupal.settings.basePath + 'mymodule/'  + 'load-content' + href,
          type: 'GET',
          //data: data,
          dataType: 'json',
          success: function(response) {
            console.log(response);
            $("#block-system-main").html(response);
          },
          error: function() {
           // show error in any DOM.
          },
      });
          });

I am using views_embed_view function and returning output as json but I get 500 server error.

Any idea how can I achieve this?

Thanks


texts: How can I add a field to a view that is calculated using other fields?

texts:
How can I add a new field to a view that is calculated using other fields?

Is there a way native to Views to accomplish this?

If the original view returns the row: X | Y | Z

And I have a function calculating new data: $new = do_something(X, Y, Z);

How can I include $new as a fourth column to resulting in: X | Y | Z | $new

I have looked into using a views template to accomplish this, but I'm curious as to whether there is a better way to do this using Views hooks or another module.

What templates, hooks or modules would be best suited to accomplish this?


texts: Is there any way to cancel user votes (if there are any) when I completely delete a user account?


texts: Can I set a View's permission based on the viewing user's group membership?

texts:
I have a view of user profiles configured as such.

However, I'd like to restrict this view to only members of the same group. Is this possible? How should I approach it?


texts: How would I print out the first instance of a paragraph bundle in a node template?

texts: I have a node type article with a paragraph field field_sections with the available bundles section_image and section_text.  In my node.html.twig file I'd like to render out the first instance of any section_image bundles that may have been added. Any ideas on how to achieve this? Not sure if twig logic is correct way to go about this or if I should have a function in my .theme file that does the logic and returns a variable to do this that I could use in the twig file.


texts:
How can I inspect the $form element from the hook_node_insert($node, $form, $form_value).
I need to know how it construct.
I try with firephp (dfb($form, 'form', FirePHP::LOG);) with no success.
Please help.


texts:
I apologized as I'm not well versed specifically with drupal. But anyway, I was migrating an existing installation on a Windows Server to a Linux Server (debian).

I went ahead and moved all the files, setup the database, updated settings.php in /sites/default

I also chown'd with correct user, and set /sites/default/files to 777 permissions with all other directories set to 755 and files set to 644.

I have errors with some images, css, and js. I checked the files, and they exist. When attempting to access via GET request (http protocol) I get 500 Internal Server error.

Looking at PHP's error logs I see these alerts (no errors):

/sites/default/files/.htaccess: Option FollowSymLinks not allowed here

When I edit said .htaccess files to:

#Options None
#Options +FollowSymLinks

The images load, but the CSS and JS does not (it exists but tries pulling from incorrect directory). I am also worried about security in this folder.

ie:

Actual Request: GET site.com/css/css_49249400b301b59bd86200648ba96215.css

Correct Request: GET site.com/sites/default/files/css/css_49249400b301b59bd86200648ba96215.css

Anything I could be doing wrong?

Help is appreciated!

UPDATE:
Rewrites are enabled and working.


texts: Drush @sites alias does not work in a multisite installation

texts:
I have 3 Drupal sites installed and I've developed a simple "hello-world" command that just does the following:

drush_log(getmypid() . ' Hello world!', 'ok');

When I run drush @sites hello-world I get the following error message:

  Could not find a Drupal settings.php file at sites/default/settings.php

Please note that the command is working fine when run for a specific site.

drush -l test1 hello-world

I was under the assumption that Drush @sites alias should be available by default. Is it not?


texts: Redirect only after inserting a new node?

texts:
I had a rule of 'After saving new content' of type, redirect to url. I need to add second submit button to the content type so I decided to add the redirect to a custom module so I can have different actions depending on the button. The redirect works on the submit button but I only want this to happen when adding/inserting a new node. Right now it redirects every time the submit button is clicked.

In mymodule_form_alter:

$form['actions']['submit']['#submit'][] = 'submission_form_submit';

Then:

function mymodule_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'info-received';
}

Code suggestions needed. But if there is a way to have rules perform different actions based on which button is clicked I can use that advice also.

ETA: the code used for the second button

$form['actions']['submit_another'] = array(
  '#type' => 'submit',
  '#name' => 'save_another',
  '#value' => t('Save, and Add Another.'),
  '#submit' => array('node_form_submit','submission_form_create_duplicate_form_submit'),
  '#weight' => 40,
);

ETA2: Trying is_new

function mymodule_form_submit($form, &$form_state) {
  $node = $form_state['node'];

  if(isset($node->type) && $node->type == 'submission') {
    dsm('Reached Node Type Check!'); // <- this works

    if (isset($node->is_new)) {
    dsm('Reached New Node Check!'); // <- this does not work
    $form_state['redirect'] = 'info-received';
    }
  }
}

Changed the if statement checking for new node to

if ($node->is_new) {

Results in 'Notice: Undefined property: stdClass::$is_new in mymodule_form_submit()'

It seems the value for is_new is not set.


texts: How to add a profile field in page--user.tpl.php

texts:
I need to put a profile field in page--user.tpl.php.

I try this :

function THEME_preprocess_page(&$variables) {
  global $user;
  $user_fields = user_load($user->uid);
  $variables['myfield'] = '';
  $myfield = $user->field_myfield;
  if($myfield) {
    $variables['myfield'] = $myfield['und'][0]['safe_value'];
  }
}

But i have an error :

Notice : Undefined property: stdClass::$field_myfield dans THEME_preprocess_page()

Do you know where should come the problem ?


texts: Generating links from words using an input filter

texts: Does anyone know of a D6 module that can do this easily? Really I just want to find certain words in forum posts and link them to other nodes.


texts: How can you have Composer install the site in the project root not in web/?

texts:
I have downloaded Drupal 8.8 through composer drupal/recommended-project. The downloaded files structure is diff than previous download. Now core and other files are stored in web folder and vendor is out of core.

So my question is how to setup site in public_html/. I have uploaded files entire files under public_html/ but site not works. I also tried to access example.com/web but does't work.

How can I fix that?


texts: How do I throw values calculated back to buildForm()?

texts:
I am trying to throw back values that are calculated in submitForm() to buildForm().

How do I add more state values into it?

    /**
     * @file
     * Contains \Drupal\resume\Form\ResumeForm.
     */
    namespace Drupal\resume\Form;

    use Drupal\Core\Form\FormBase;
    use Drupal\Core\Form\FormStateInterface;

    class ResumeForm extends FormBase {
      /**
       * {@inheritdoc}
       */
      public function getFormId() {
        return 'resume_form';
      }

      /**
       * {@inheritdoc}
       */
      public function buildForm(array $form, FormStateInterface $form_state) {
         $form['number1'] = array(
          '#type' => 'textfield',
          '#title' => t('number 1'),
          '#required' => TRUE,
        );

        $form['number2'] = array(
          '#type' => 'textfield',
          '#title' => t('number 2'),
          '#required' => TRUE,
        );

        $form['actions']['#type'] = 'actions';
        $form['actions']['submit'] = array(
          '#type' => 'submit',
          '#value' => $this->t('Save'),
          '#button_type' => 'primary',
        );

  $header = array(
    'total',
  );
  $output = array();
  foreach ($form_state->getValues() as $key => $value) {
     $output['total'] = $total;
  }
  $form['mytable'] = array(
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $output,
    '#empty' => t('No Data'),
  );

        return $form;
      }

      /**
       * {@inheritdoc}
       */
      public function submitForm(array &$form, FormStateInterface $form_state) {

        foreach ($form_state->getValues() as $key => $value) {
          drupal_set_message($key . ': ' . $value);
        }

$total = $form_state->getValue('number1') * $form_state->getValue('number2');

    $form_state->setValue('total',array($total));

           }
        }


texts: path_to_theme() goes to parent theme not subtheme

texts:
I'm using zen as my parent theme and for some reason path_to_theme() is suddenly printing /sites/all/themes/zen instead of the subtheme /sites/all/themes/<mytheme>. What's even more confusing is that it's only happening when node/12 is being displayed.

Could this code have something to do with it?

<?php
//template.php
if(isset($vars['node'])){
    if($vars['node']->nid == 12) {
        $vars['is_request_quote'] = true;
    }
}
?>

I use the variable $is_request_quote to change the layout in page.tpl.php. I do this through <?php elseif( $is_request_quote ) : ?> -New layout here- <?php endif; ?>.  Could that be the one affecting it?


texts: Reference a filename in form validation for an image

texts: I am new to Drupal and am making a module to alter a content type. I have a content type that allows a user to submit an email and an image and I want to change the filename of the image to the email before it submits to the database. I figured I can do this in the form validation but I am having trouble finding the right code to access the filename value using $form_state. I am using the form alter hook and adding to the validation.


texts: Unsetting formatter's third party settings

texts: We have this hook hook_field_formatter_third_party_settings_form that allows us to set third party settings in formatter settings form. But what would be the best way of unsetting them if we are changing formatter to one that doesn't support our setting?


texts: how to detect current language to show the other(s) in the menu

texts:
I'm using i8n to host a bilingual site and I only like to display the inactive language in the top bar. What php code do I need to detect the current language so I place the inactive language in the template?
Thanks:

<a href=
<?php
global $language;
if (($language -> name) == 'English') {
print "\"http://www.mangallery.net/fr\"".">french";
} else {
print '"http://www.mangallery.net"'.">english";
}
?>
</a>


texts: how to display the list of unread nodes and read nodes

texts:
I want to show the list of unread nodes and read nodes.
Actually, My scenario is to show the article listing page. The page contains the drop-down contains all, read and unread. The all list all the articles, In read, need to list the contents already read by the user and In unread, need to list the contents not-read by the user. For read, I did with recently-read module but that is not tracking the unread nodes. Hope somebody have already worked with this.

Thanks advance.


texts: How to properly call dependency classes (Class not found)

texts:
I'm creating a custom module that uses PHPMailer, which has been installed in the module's vendor folder via composer.

This is the error I get:

Error: Class 'PHPMailer' not found in Drupal\multisend\Service\MailerService->__construct()

PHPMailer is being used in a service class and a PHPMailer object is being created in the service classes constructor. Here is the code:

<?php

namespace Drupal\multisend\Service;

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

class MailerService
{
    private $mailer;
    private $config;
    private $attorney_data;

    public function __construct($attorney_data)
    {
        $this->mailer = new PHPMailer(true);
        $this->config = \Drupal::config('multisend.settings');
        $this->attorney_data = $attorney_data;
    }

    ...

I've even tried require() on the PHPMailer class but no luck. If anyone could give any suggestions, I would appreciate it greatly.


texts: Why is the 'values' array not set on an unsaved entity? Is there a way to make it get populated?

texts:
When I load an entity, its protected 'values' property contains all of its field values.

But when I create a new entity with MyEntityClass::create($array_of_values), its 'values' property is not set until I have saved it.

Is there a way to get that set, for the purposes of debug output?


texts: Connection timeout when using backup module

texts:
Currently running Drupal 7.65. Trying to update to 7.67 due to the security update.

I've been trying to run the backup & migrate module to back-up my site, but even when doing partial back-ups (e.g. just of the CiviCRM database), the site times out after 180s and I get this error message:

I spoke to our host who increased the disk quota by 2000MB but that didn't do anything.

I then added the following code to the htaccess file in the root folder, through CPanel:

    # Increase connection timeout.
    <IfModule mod_php5.c>
    php_value max_execution_time 300
    </IfModule>

However it's still timing out after 180s. (Rather than 300s that the code should be setting.)

I need to back-up the site before I do the security update, can anyone advise why this is timing out and what I can do?

It's not a massive site... disk usage is 7GB out of 12GB, and MySQL disk usage is 2.2GB out of 7GB. Is there something I'm missing to make sure the code I put into the htaccess file is actually implemented...?

Thanks in advance - please let me know if you need more info, IT is not my area of expertise!


texts: Change article Status based on Workflow module

texts:
I have Workflow set up properly. But when an article is created, it is set to Published automatically. It doesn't appear to the public though, unless the Workflow status is set to Live.

Is there a way to customize the status to be more specific (e.g. say "Pending Review" when the workflow is in Review status, then say "Published" when workflow is in Live)?

Thanks.


texts:
I have a node with a field called "field_paragraph" which is a paragraph reference.
Referencing a paragraph type which has a field called "field_image"

I'm trying to get the url of the field_image in a custom module and so far i have this. But i don't seem to get it work.

use Drupal\paragraphs\Entity\Paragraph;
use Drupal\node\Entity\Node;
$node = Node::load($nid);
$paragraph_field = $node->get("field_paragraph")->getValue();
$paragraph = Paragraph::load($paragraph_field[0]['target_id']);

Here is where the problem occurs

$uri = $paragraph->field_image->entity->getFileUri();

The above returns nothing.

I used kint to print "$paragraph->field_image->entity" and it returns null.
What I'm I doing wrong? I tried all answers I could find on here to no avail.

After getting the uri I think calling the below line would be enough.

$url = file_create_url($uri);

Question: How do I get the url of an image field in paragraphs programmatically?


texts:
I'm rewriting the results in a view. I've added taxonomy term ID field and hidden it from displaying.

This is the rewriting code:

[name]

This is the result generated:

Constitution

The problem is the comma in [tid]. I want Drupal to not to insert comma there i.e.. instead of 1,007 I want 1007.


texts: Regular session table crashes, on a large multi domain, multi site Drupal set-up

texts:
I have recently been assigned to a project that has regular session table crashes.

Drupal outputs an error like this one:
"Warning: Table './[database]/sessions' is marked as crashed and should be repaired ..."

The problem with this site is that it started as a small drupal site and various companies have added (custom) modules to it. The site has also been ported to a number of different hosting providers with varying results. Currently it is being hosted at OVH on a shared hosting setup.

The site is rather large now with a constant base of 20 users inserting data simultaniously (on different accounts but through the drupal interface), mostly pictures through a multi upload module. At the same time there is a lot of traffic coming from anonymous users (who do not upload anything at this point).

I think the problem might be the shared hosting platform. I think it might not be able to cope with all of the different inserts and just crashes...
Normally I would see if I could cause the crash in some way, but I can't take the site down since it will result in a major financial loss to the company.

I've read some other posts here regarding a large session table where they mentioned the "ini_set('session.gc_maxlifetime',   200000);" line in the settings.php file.
The "answer" was to reduce the amount of sessions to 900-1800 which would result in a smaller session table, but I don't know if this would solve the problem?

To make matters worse my client cannot give me any information on when the crashes occur, if they are perhaps caused by using a custom module, etc.
The site is running on Drupal 6.

I realize there is not a lot of useful information in my post and I apologize for that.
I am a new Drupal developer and I don't know how to address this problem.
(The developer who was handling this issue before I got here quit...)

Any help in this matter would be appreciated.

Thank you.


texts: "No query was run" when Contextual Filter is added. Was working before

texts:
I have a bunch of nodes with terms in a certain vocabulary. The vocabulary consists of doctors' specialties, like "Gynecology / Obstetrics". Terms in this vocabulary have a few extra fields:

Singular noun form ("Gynecologist / Obstetrician")
Plural noun form ("Gynecologists / Obstetricians")
URL string ("obgyn")

I have a view that displays all the nodes associated with the term. The view's path is "doctors/specialties/%", and it has a Contextual Filter for the URL String field of the taxonomy term, via a taxonomy Relationship. So when you go to /doctors/specialties/obgyn, you get a page with a heading "Gynecologists / Obstetricians" and then all the content with that term.

This view previously worked perfectly, but at some point something changed, and now it returns 404. The preview in the Views UI just says "No query was run". When I delete the Contextual Filter, it shows all the normal SQL, but when I re-add it, it goes back to "No query was run".

Here's a dump of the view. Can anyone tell me what I'm doing wrong?


texts: Apache Solr: get list of "More Like This" nodes programmatically

texts:
I'm using apachesolr module and it's "More Like This" block.

This block displays only titles of similar nodes as links to these nodes. I need to display rendered nodes with specific view mode. How can I do this programmatically?


texts:
I'm desperately trying to debug some problems I'm having with creating an manipulation of nodes in drupal 7 Services 3.

I've tried to insert a few debug statements to figure out where things are going wrong. When I create a node using poster (from the browser) it worked great, it prints the info I want.

When I do it from my app (iphone app), the same function is called, but the debug does not seem to print out to the page, even if I refresh it. I wonder what I am doing wrong.

Thanks


texts: let user join a group only if he is member of another group

texts:
I mean for example in a sub-group structure:

Group1

-Subgroup of Group1

I want to validate that if user wants to join "Subgroup of Group1" he must be member of Group1

how would be the rule?
Thank you


texts: How to apply CSS to "views-exposed-form--view-name.tpl.php"

texts:
I am theming a views exposed form which is a block. The views filters are displayed in a block and I am theming this using "views-exposed-form--view-name.tpl.php". I want to apply CSS to this template file.

How to do this.


texts: How to add additional display (view mode) for all node types?

texts:
Firstly, I've seen this question, have followed the steps in the answer by FranCarstens to no vail.

To clarify: I want to add custom views to all content types. (as a side question, would be nice to know how to target a specific node type, if possible).

I've created the modules, enabled it but it doesn't show as an option in any of my content types.

What am I missing?

Thanks!


texts: What is the best way to update/add paragraphs with REST on a node

texts:
I have a node with a paragraph. This paragraph has a couple fields and there can be any number of these paragraphs on a node.

I want to update this node via REST.  This is some of the GET output:

"field_region": [
    {
        "target_id": 13,
        "target_type": "taxonomy_term",
        "target_uuid": "2ae47cc7-c1c2-477d-8f23-b124e964f83a",
        "url": "/regions/california"
    }
],
"field_tactic_disbursements": [
    {
        "target_id": 9,
        "target_revision_id": 13,
        "target_type": "paragraph",
        "target_uuid": "1c98b1aa-f443-47fe-baff-1ecd0b499d1f"
    }
],
"field_year": [
    {
        "target_id": 1,
        "target_type": "taxonomy_term",
        "target_uuid": "58f65d10-143f-4a23-9315-52220c433602",
        "url": "/years/2018"
    }
]

Based on how this is, it looks like I will have to do a separate PATCH/POST request for each paragraph.   Is there a way to do this in one request?

I'm thinking about creating  a custom Resource to handle this but not sure if there is a better way.


texts: Changing the content of one node reflecting in other node created using node clone

texts:
I used node clone to create similar contents. After creating the content using node clone, I have disabled and uninstalled node clone module.

Now, whenever I try to modify something in the cloned content or original node, both are getting reflected with the recent changes. Why is this happening? How do I resolve this?

Note: I have uninstalled the module and cleared performance cache many times now. Weird thing is, these changes are applying only to field collection fields.


texts: How to access PrivateTempStore data when user registers

texts:
I have a form for anonymous user some steps before the user registers. I save the data in the PrivateTempStore. A final step is to register and log in. But when a user is logged in, the PrivateTempStore seems emptied automatically.

I want to attach the previously saved data in the PrivateTempStore to my new logged in user, what is the best practice to do this?

Right now I am saving the data to extra hidden fields in the register form, but this seems overkill.


texts:
I was able to theme the form. Now I want to put a submission button into a <div>, but I can't theme the submission button.

This code worked for the form.

print "text text text";
print drupal_render_children($variables["form"]);

Here is the code I used to theme the submission button.

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => t('Submit'),
  '#attributes' => array('style' => "padding: 0 10px;"),
  '#theme' => "submit",
);

function scores_theme($existing, $type, $theme, $path) {
  $path = drupal_get_path('module', 'scores');
  return array(
    'submit' => array(
      'render element' => 'submit',
      'template' => 'submit',
      'path' => $path,
    ),
  );
}

What should I put into submit.tpl.php? Any of these doesn't work.

print drupal_render_children($submit);

print drupal_render($variables['submit']);

print drupal_render($submit);


texts: Adding a view desktop link to mobile site

texts:
I am using X-AH-Mobile-Redirect in the settings.php file to redirect visitors to the mobile site. I need to add a link so that visitors can switch to the desktop site.

Here is a snippet of the redirect code:

    if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
  switch ($_ENV['AH_SITE_ENVIRONMENT']) {
case 'dev':
   header('X-AH-Mobile-Redirect: http://m.mysite.com');
  break;
  }
};


texts: How to change field value before display?

texts:
I have defined custom Integer field in commerce product entity. I would like to achieve, that if field should be displayed on the website (i.e. in some view) and if field value == -1, then text string t('Unlimited') should be displayed instead of field value.

Is it possible to change field value before display? I would like to change only output of the field value, not value in database.

I have created field using UI, not programatically, so I think I cannot use many of hooks concerning fields like hook_field_prepare_view.

I don't want to use preprocess function in my theme, because I would prefer solution that will work independent on current theme.


texts: Performance and loading times of theme like Zen vs building a theme from scratch?

texts: Ive used Zen for every Drupal site ive made for years so im well aware of the benefits and how much it speeds up front end development. However I have noticed that there are far more div tags and css than would be needed if I built a theme from scratch and only included exactly what was needed. Especially as my clients are increasingly interested in mobile optimisation, are there any stats or anecdotal evidence about how much of a performance hit this extra markup is causing?


texts:
Please bear with me on this one, as I am a complete newbie with Drupal, and am helping out a client on this one, so am trying to relay the problem they are having.

It appears that they are having trouble with a Node module, this module is used to add events and sell tickets to these events.

Currently when a new event is added by 'admin' it is only viewable by admin, so anonymous users can't see any see any events events. We think it has something to do with permissions or a between some modules, but as a say not really understanding the product i'm struggling to get to the bottom of it.

One of our developers also thinks that it could be something relating to a field used in the event, and user doesn’t have access to read this field (permissions).

It seems that for each there is a diferent permision filed in permisions section in admin panel.

Has anyone had this trouble before? Any help, ideas or even questions on this very  welcome. We may have to get someone in to finish this job off.

I may also have most of this backwards, so please ask if you need anymore info, or what I should look at and I can supply this straight back to you.

Thanks for the patience :)


texts: Removing Email Address Required Field for Anonymous Users in Drupal Commerce

texts:
I have an email address field that shows up at the top of my commerce checkout form for anonymous users. It's a required field. However I've added my own email address field to the form further down the page in the billing information area. I don't want the account information fieldset and associated email address field at all because only anonymous users use the site.

Does anyone know where I can find this email address field...is it in views somewhere? I'd just hide the whole fieldset but the field is required so I need to actually remove it from the code somehow.


texts: How to prevent Content type from appearearing in built-in Search results

texts:
I've got thousands of nodes which were created by importing using a Feeds module. I only want them to be searchable via the views search form, not by the built-in site search.

Is it possible to disable these nodes from being searchable by the built-in search, while still making it available to the search generated by a View?