texts: Show content whose "team" field matches the user "team" field

texts:
The users on my site all have a field named "team" and my content types also have the same field.
I want to create a views page that shows all nodes where that "team" field equals the same field on the user node.
Example:
USERS:
user1, team: team1
user2, team: team1
user3, team: team2

NODES:
node1, team: team2
node2, team: team1
node3, team: team1

When I'm logged in as user 3, I want my view to show node 1.
I know that I have to work with the contextual filters and context but I'm unable to get the output I need.


texts:
In my D7 installation I'd like to have a view where all roles are listed followed by the number of users that have that particular role.

i.e. of my expected result:

role 1: 2
role 2: 5
role 3: 1
role 4: 8

In addition to this, when I can exclude a role (the admin role) from this view, it would make my day...

Thanks for your support!


texts:
I have a custom content type which has grown in fields count and all that UI hints and stuff. It now takes about 4-5 screens to scroll. I was wondering if anyone knows of a module/way that allows to re-organize the Add Content UI form into sections. For instance - I would like to have all head data (title, teaser text, description) on a separate tab, all taxonomy qualifiers on another one, all images and uploads on yet another one, etc.

I think such a re-organized way will be much more friendly for the client to fill up with info and to maintain as well.

Anyone?
Artur


texts: Change the subtotal amount in commerce_email_order_items

texts:
First, sorry for my poor English, and the faults you will probably found.

Globally, what I am trying to do , is to add the shipping amount into the 'base_price' component price, also labelled subtotal.

So far, it's working correctly on the site itself with the use of the hook hook_commerce_price_formatted_components_alter().
To give you an idea, here is the code that handle it.

function base_price_shipping_commerce_price_formatted_components_alter(&$components, $price, $entity) {
    // We modify $variables to "merge" base_price and shipping
if ( isset($components['base_price']) && !empty($components['base_price']) &&
    isset($components['flat_rate_expedition_internationale']) && !empty($components['flat_rate_expedition_internationale'])) {
    // We calculate the new price with included expedition
    $price_with_shipping_amount = $components['base_price']['price']['amount'] +
        $components['flat_rate_expedition_internationale']['price']['amount'];
    // We format this price with the used currency
    $price_with_shipping_formatted = commerce_currency_format($price_with_shipping_amount, $components['base_price']['price']['currency_code']);
    // We update the display of base_price component with the new price
    $components['base_price']['price']['amount'] = $price_with_shipping_amount;
    $components['base_price']['formatted_price'] = $price_with_shipping_formatted;
    // We unset the display of shipping
    //unset($components['flat_rate_expedition_internationale']);
}
}

Now the problem is to do the same thing with the token [commerce-order:commerce-email-order-items].
I know it's generated with commerce_email_order_items() and by commerce_email_prepare_table() specially.
But I don't get to understand how to make it work, or where to make the change.

Directly and overide the function commerce_email_prepare_table() ?
It will probably be around the ligne 174 in the commerce_email.module file :

$data = $wrapper->commerce_order_total->data->value();
 if (!empty($data['components'])) {

   foreach ($data['components'] as $key => &$component) {

     if ($data['components'][$key]['name'] == 'base_price') {
    $rows[] = array(
      'data' => array(
        ' ',
        array('data' => t('Subtotal:'), 'style' => array('font-weight: bold; text-align: right;')),
        array('data' => number_format(commerce_currency_amount_to_decimal($data['components'][$key]['price']['amount'], $currency_code), 2), 'style' => array('font-weight: bold; text-align: left;')),
      )
    );
  }

Another possibility is to change the amount of the 'base_price' component, not on a formatted level (which just change it before display), but at the "root", for real. I don't know if I am clear enough.
But after days of research and try to understood the Price API, I still don't get it, and which hook or function to use :
http://www.drupalcontrib.org/api/drupal/contributions%21commerce%21modules%21price%21commerce_price.module/7

Which way do you think is the best ?
Thank you for reading.
Pierre.


texts: "Filename cannot be empty in file_unmanaged_save_data()"

texts:
We're using Drupal 7.20 and this error message started appearing after trying to add a new context. I removed the context condition, and even restored drush arr from a dump from Friday. All files belong to apache (chown -R apache:apache) and group/owner can do everything (chmod -R 775 * #temporarily).

The message still persists.

  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.
  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.
  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.
  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.
  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.
  Warning: file_put_contents(): Filename cannot be empty in file_unmanaged_save_data() (line 1903 of /var/www/html/includes/file.inc).
  The file could not be created.


texts: How to reuse value from a custom Views field handler in a second Views field?

texts:
I have a custom Views field handler:

function MY_MODULE _views_views_data() {

 $data['Customer']['Cust_Number'] = array(
    'field' => array(
      'title' => t('Customer Number'),
      'help' => t('This is the account number.'),
      'id' => 'numeric',
    ),
  );

I need to reuse the Cust_Number field in another, second field which will have a custom handler like:

  $data['Customer']['Cust_Number'] = array(
    'field' => array(
      'title' => t('Customer Next Service'),
      'help' => t('The customer next service date.'),
      'id' => 'customer_next_serv',
    ),
  );

Where this second has a custom id for its handler so I can use the base field value for a different, custom output.

I suspect it's not possible to have multiple fields for one table value, correct?

If not, is there another way to use the same table column field and have two different handlers for it (numeric and custom)?


texts:
In a module, I am using the following code.

function mysimple_form($form, &$form_state) {
  $form['#method'] = 'get';
  $form['#action'] = '/buy/{_val_}';
  $form['search_location'] = array(
    '#type' => 'textfield',
    '#title' => 'Search',
    '#default_value' => t('kathmandu'),
    '#size' => 60,
    '#maxlength' => 128,
    '#required' => TRUE,
    '#attributes' => array(
      'placeholder' => t('Search')
    )
  );

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

  $form['#submit'][] = 'mysimple_form_submit';
  return $form;
}

function mysimple_form_submit($form, &$form_state) {
  krumo('asdsads');
  die();
}

I am using that form in hook_node_view().

function mymodule_node_view($node, $view_mode, $langcode) {
  $form = drupal_get_form('mysimple_form');
  $node->content['simpleform'] = array(
    '#weight' => -1,
    '#markup'=> drupal_render($form)
  );
}

The form is displayed perfectly, but the callback function doesn't seem to work.
I also tried $form['actions']['#submit][] = 'mysimple_form_submit'; and  $form['actions']['submit']['#submit][] = 'mysimple_form_submit'; but the form submission handler is still not invoked.


texts:
is there a way to configure a date form so it has no default value?
Setting the default value to NULL sets the default value automatically to the current date.

  /**
   * @return array
   */
  public function getFormFieldSampDate() {
    return [
      '#type' => 'date',
      '#title' => t('Date of Sampling '),
      '#default_value' => self::dateStringToArray($this->sampling_date),
    ];
  }

Thanks


texts: How to add custom Views filters (for example, date between X & Y, but specified by myself)

texts:
As per title. I am aware that there is a specific filter for date between X and Y, but if I wanted to programmatically develop it, what ways are there to do this?

EDIT : To be more specific, I am using Views 3 so that I can use apache solr views on Drupal 6.


texts: Is it possible to get a clean url to be used in Views comment counts?

texts:
I have a Views view of some news nodes.
Each of the news nodes has "Generate automatic URL alias" ticked in the "URL path settings" of the node. This is great and gives me nice clean URL's.

However in my comments field in the view when I go to "REWRITE RESULTS" "Output this field as a link" and set the "Link Path" I am unable to find a token that gives me the same clean url that my title field can have or even my Node: Link field.

Is it possible to use the clean urls for comments and if so what is the token?


texts: What's the functional difference between the "disabled" and "external" caching setting?

texts: I've seen the answer elsewhere that "External lets you use varnish, etc" but what are the internal differences between external and no caching? Does external actually cache anything, or is there a difference in headers sent?


texts: How to search more fields using single text field textbox

texts: I have a content type with fields title, body, short description & long description. In view i added these fields. i need to add an exposed search text-field in view to search the search term in title, body, short description & long description fields. Views search term is not happening for me. Combine search is only taking maximum 2 fields. Please help


texts: How to print token in webform-confirmation.html.twig?

texts:
I would like to output a submitted value as a token on the confirmation page through the twig. The token works just fine when added into the message box of webform as:
[webform_submission:values:score_percentage]

But I can't seem to get the same value to output through the twig. I have tried:
{{ webform_token('webform_submission:values:score_percentage') }}
{{ webform_token('[webform_submission:values:score_percentage]') }}
{{ drupal_token('webform_submission:values:score_percentage') }}
{{ drupal_token('[webform_submission:values:score_percentage]') }}

But they all just print the token itself, like:
webform_submission:values:score_percentage
[webform_submission:values:score_percentage]
[webform_submission:values:score_percentage]
[[webform_submission:values:score_percentage]]

I saw another post about (what I think is) the same thing here? But I haven't been able to see my error...
As well as this old issue, which by the looks of it would be fixed now.
I have the latest versions of Twig Tweak (8.x-2.9) and Token (8.x-1.9) installed. Am I doing something fundamentally wrong here?


texts: Prevent Development modules from being added to configuration management

texts: We have modules that are only used for local development like Stage File Proxy. How would I prevent these modules from being added to the configuration management?


texts: Why Recent log message is showing anonymous user?

texts:
Whenever I do cron/clear cache, that activity are shown as anonymous in log message, while my login activity are shown with my name as shown in following image.

Should not be user be administrator's name instead of "Anonymous(not verified)" in case of cron? Is this by design or I am missing something in config? Thanks.


texts:
I'm still new to Drupal 7. I've read a couple of things on how Drupal works, but I don't quite get some things though.

How do I create articles for different categories? I would like to make articles that can be listed under graphics, painting, or 3D etc. How can I categorize them in the main menus? How different is this to the blogging module or book module?

I know this may have been posted similarly here, but I would just want a simple explanation not found in long chapters. Thanks guys.


texts: Comment permission by role and content type

texts:
I have different roles (e.g. A, B, C) and I have different contents in a menu (e.g. A, B, C).

I want that only the user A can post/edit comments on content A,  and not on B and C.

So I don't know what module can help me with that.


texts: Inline Entity Form - How to Theme the referenced form edit screen with a tpl.php file?

texts:
Inline entity form (IEF) is a module that lets you create other nodes/entity inside of a node edit form (or reference them).

I would like to theme the form edit screen using a tpl.php file. (By form edit screen, I mean the place where the inline form is displayed for the user to input data and not the display that shows the finished form (e.g. so the 'edit' part and not the 'view' part),

This thread explains how to change values of the fields of the IEF creation screen. But it doesn't show how to use a tpl.php.file.

This tutorial and this tutorial explain how to theme forms. However, their knowledge doesn't seem to apply to Inline Entity forms (mainly because IEF forms don't use a form element).


texts: How can I remove some content types of the admin menu?

texts:
I have drupal 6.x and I have installed the module "Admin menu".  I want to know how can I remove some content types of the menu?  I have looked that this menu loads all options of the website and  I only require to remove the some content types of the menu.

Thanks for your help.


texts: Maintain in-house repository of custom modules?

texts:
Whenever a contributed module has a new version, Drupal's update manager will show a notification and allow automatic downloading of the updates. After that, the user is guided through "update.php". Is it possible to get the same automatic treatment for custom modules?

If I develop a few custom modules for a specific site, it would be interesting to get Drupal to look for updates of said custom modules, on a server specified by me, where I'm hosting the modules myself, and treat them like any contributed module. But maybe this goes against good practices?


texts:
In drupal 7 I have news posts grouped by the value of certain fields, I can filter them and display correctly the latest # news per category in a tabbed view: one tab per category. I also have another tab, which should collect the last news item from each category and I'm struggling to do it right.

I tried the nested views approach but despite creating a new template and new "helper" views with which I had hoped to strip all unnecessary tags, many tags are still created, breaking the layout (not really BREAKING, but it's not as it should).
Could someone suggest a way to strip the tags or (better!) to do this in one go?

I'm not a php/drupal dev but if assisted I can understand code.

Update:

I have narrowed down my problem to the fact that all items are rendered in one single row by the external view. This breaks the layout because there's no </li><li...> between them. Instead, they are wrapped by divs. I have worked on this but I don't know how to make them appear on separate rows and it seems all the remaining wrapping is created by the last print $row in the chain.
Can I change the behavior of the print or make the view display each field on a separate row?


texts:
I have a script with a behavior which receive settings by a block. The problem is that when I'm logged as admin the behavior is executed but when I'm an anonymous user, the behaviors isn't executed.

Can you help me ?

I Define this block :

public function build() {
        $config = $this->getConfiguration();

        // Check if the conf
        if (empty($config['token']) || empty($config['pagename']) || empty($config['pageurl']) || empty($config['limit']))
            return array('err' => array('#markup' => t('You must configure the block.')));

        $build = [];
        // Create the wrapper to include facebook posts
        $build['facebook']['timeline']['#markup'] = '

';
        // Push conf vars
        foreach ($config as $key => $value) {
            $build['#attached']['drupalSettings']['myc_fb'][$key] = $value;
        }
        // Includes libraries
        $build['#attached']['library'][] = 'myc_facebook/myc_facebook';

        return $build;
    }

And here is my js :

jQuery(document).ready(function($) {
    console.log("hello 1");
    console.log(Drupal);
    Drupal.behaviors.myc_facebook = {
        attach: function (context, settings) {
            console.log("hello 2");
    };
});

And it's how I define my library :

myc_facebook:
  version: 1.x
  js:
    js/script.js: {}
    js/timeago.js: {}
  dependencies:
    - core/drupal
    - core/jquery
    - core/drupalSettings


texts:
I am trying to return a taxonomy tree in the JSON format but the issue is that I would like to have it nested based on the depth of the term, like the following format:
What is the easiest way to do this?

 {
            label: 'term1',
            children: [
                { label: 'term1.1' },
                { label: 'term1.2',
                  children: [label: 'term1.2.1'] }
            ]
        },
        {
            label: 'term2',
            children: [
                { label: 'term2.1' }
            ]
        }
    ];

Thanks,


texts: How do I preserve GIF animation with the image field and image styles?

texts:
Currently, when I upload animated GIFs to image fields, image styles breaks the animation as part of the crop/resize sequence.

I'd love to be able to preserve animation while also taking advantage of image styles. Is there a way to achieve this?


texts: Inserting NULL value with db_query OR db_write_record

texts:
I have a table called foo_bar whose fields are as follows

id int(10) unsigned NOT NULL AUTO_INCREMENT
name varchar(255) DEFAULT NULL
amount float DEFAULT NULL

I want to enter the value to this table like this

$name_value = 'Dollar';
$amount = NULL;

db_query("INSERT INTO {foo_bar} (name, amount) VALUES ('%s', %d)", $name_value, $amount_value);

But now when I see the values into the table it showed me

id | name   | amount |
1  | Dollar |      0 |

I tried db_write_record as well like this...

$obj_foo_bar = new stdClass();
$obj_foo_bar->name = 'Dollar'
$obj_foo_bar->amount = ''

But I am getting the same result.

EDIT: 17 Sep 2012

Don't use drupal_write_record for insert/update queries where you want to place the default value to NULL

INSTEAD: Use content_write_record which is used by CCK module to update the database tables were you want to place default value as NULL.

This function says Directly copied from core's drupal_write_record, which can't update a
column to NULL. See http://drupal.org/node/227677 and http://drupal.org/node/226264 for more details about that problem.


texts: Controlling a dependent field in a multi-instance paragraph

texts:
The fields below are part of the node/add node/edit forms of my custom node type.

The paragraph field_para_city contain one field_city. (I later need to add other fields in the paragraph).

The user can add multiple instances from field_para_city.

field_city has an allowed_values_function defined in a YML file, which returns all possible cities from all countries.

I created a class MyNodeTypeForm extends NodeForm, with a public function buildForm(). This function adds AJAX to field_country so that when it changes (i.e. the user chooses a country) it (re-)populates all the existing instances of field_city (inside the field_para_city instances) with corresponding list of cities (e.g., London and Cardiff for the UK).

In MY_MODULE.module, I added the following so that the above code is executed on the node/add and node/edit forms.

function MY_MODULE_entity_type_alter(array &$entity_types) {
  $handlers = $entity_types['node']->get('handlers');
  $handlers['form']['default']  = 'Drupal\MY_MODULE\Form\MyNodeTypeForm';
  $handlers['form']['edit']     = 'Drupal\MY_MODULE\Form\MyNodeTypeForm';
  $entity_types['node']->set('handlers', $handlers);
}

All works fine, except when the user add or remove instances of field_para_city ("Add city" or "Remove"), then all instances of the field_para_city are refreshed and field_city instances inside them are reset to the allowed values (all cities), ignoring the state of field_country.

The user would then need to re-select from field_country to get the correct cities again.

I found that although adding/removing a field_para_city triggered the above mentioned buildForm() function, the $form_state->getValue('field_country') was then empty, unlike when buildForm() is triggered through the field_country AJAX.

I tried to capture the state of field_country in the field_city's allowed_values_function, so that the allowed options are dynamically and directly set based on the user choice of country, but $form_state was not recognised there.

I know this is an incorrect approach!

What is the correct better approach to implement this simple use case?


texts: Service event_subscribe before path_processor_inbound

texts:
I have ha service with tag: event_subscribe (KernelEvents::REQUEST) with priority 30 and in the same module a service path_processor_inbound with priority 29

The problem is: in event_subscribe Service creo a Constant but the service path_processor_inbound is called before.
I tried all the variants of priority, but it is not the problem.


texts: I created a custom entity type using entity_info_hook and associative hooks. It works fine. Now  I want to  create a clone of the entity when I press the button Duplicate. Is there any method for this? I read Replicate module do this finely. But I can't find any sufficient tutorial for the purpose. How can I use entity_ui_clone_entity() in my module?


texts:
I have created a test site using drupal 7.

My requirement is to do an additional operation on user login.
I need to redirect the users to another form when the user clicks on login button.

In this form there will be a question and 2 buttons 'update' and 'no'.

If the user chooses update a DB update will happen and also default login action.

But if the user chooses 'no' ,login should not happen.

I have already tried user_login alter, multi-step forms and confirm_form. But nothing seems to be working. Can anyone help.?


texts: use "no cache" but input filter seems to be cached in Drupal 6

texts:
I am trying to display a add to cart button and it only rarely works. It seems to work when the cache is cleared and then not work. I have added the no cache option but this doesn't seem to do anything:

function ss_cg_filters_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Display Add to Cart button based on it\'s node/ID number.'),
      );
    case 'no cache':
          return TRUE;
    case 'description':
          return t('This will replace [add-cart:435] into the button (complete form).');
    case 'process':
          return preg_replace_callback('`\[ *?add-cart: *?(\d+)\ *?]`i', '_ss_cg_filter_add_cart_button', $text);
        default:
          return $text;
    default:
      return $text;
  }
}
function _ss_cg_filter_add_cart_button($matches) {
  $product_node = node_load((int) $matches[1]);
  return theme('uc_product_add_to_cart', $product_node);
}

Can anyone tell me what i'm doing wrong? is there a bug with caching?


texts: How can I remove the tab "Subusers" in the profile?

texts:
I have installed the module subusers and appears a tab named "Subusers" in the profile.  How can I remove this tab?

I tested this code in template.tpl.php and I didn't work:

function mytheme_preprocess_page(&$vars) {

$unwanted_tabs = array('user/%/subuser');
  foreach ($variables['tabs'] as $group_key => $tab_group) {
    if (is_array($tab_group)) {
      foreach ($tab_group as $key => $tab) {
        if (isset($tab['#link']['path']) && in_array($tab['#link']['path'], $unwanted_tabs)){
          unset($variables['tabs'][$group_key][$key]);
        }
      }
    }
  }
}

I tried with this code:

function mymodule_menu_alter(&$items) {
    unset($items['user/%/subuser']);
}

Thanks.


texts: How to use Rules to set a value for a multi-value field?

texts:
I'm trying to create an Order reference on Products when ever a new order is created. I have installed the "Order Reference" module and created an Order reference field on my product type.

Next I created the following rule:

Rules Event: After saving a new commerce line item
Rules Conditions:

Data comparison ( [commerce-line-item:type], Data value: Product )
Data comparison ( [commerce-line-item..., Data value: NAME OF TYPE )

Rules Action: Set data value [commerce-line-item..., Value: [commerce-line-item:order]

The above rule works fine as long as i limit the Order Reference field to 1 value, but as soon as it is set to multiple the rule breaks.. i get the following error for the action:

  Error: The data type of the configured argument does not match the
  parameter's value requirement.

I'm new to the Rules module and a kind a lost here. Any help?

Below is the exported rule:

{
  "rules_test_test_order_ref": {
    "LABEL": "test test order ref",
    "PLUGIN": "reaction rule",
    "OWNER": "rules",
    "REQUIRES": [
      "rules",
      "entity"
    ],
    "ON": {
      "commerce_line_item_insert": []
    },
    "IF": [
      {
        "data_is": {
          "data": [
            "commerce-line-item:type"
          ],
          "value": "product"
        }
      },
      {
        "data_is": {
          "data": [
            "commerce-line-item:commerce-product:type"
          ],
          "value": "iq_test_event"
        }
      }
    ],
    "DO": [
      {
        "data_set": {
          "data": [
            "commerce-line-item:commerce-product:field-order-reference"
          ],
          "value": [
            "commerce-line-item:order"
          ]
        }
      }
    ]
  }
}


texts:
I want to track taxonomy term tagging count in the database; for each taxonomy term, I want a term tagged count that stores the number of nodes using the taxonomy term. I know I can retrieve it with a query on taxonomy_index but it is too time consuming for me.

I've found taxonomy_build_node_index($node) and taxonomy_delete_node_index($node), which are called in taxonomy_node_insert(), taxonomy_node_update(), and taxonomy_node_delete() (node hooks).

I know a form can be altered with hook_fom_alter(). Is there a way to alter these functions as well?


texts:
I've installed GeSHi filter for Drupal 8. I've set it up so that the content type Full HTML has GeSHi filtering enabled.
I tried this on a basic page.

<code ="python">
def function_name(arg):
    pass
</code>
<python>
def function_name(arg):
    pass
</python>

For some reason, this is not being changed when I preview the page.

I do have the Libraries API installed, and it is detecting the GeSHi library.


texts: How to create custom field in ubercart 3.x checkout page?

texts:
I want to customize checkout page and remove/add some fields from client information.
How can I do it?


texts:
I recently tried to setup a dev environment for my production site and replicated the same architecture.

I've a server hosting Drupal, a second server for mysql and a memcached server. All the setup was good.

Exported the Prod DB
Installed Drush
Made sure the latest code is pulled
run Drush status

Drupal version         :  7.37
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  ip address
 Database port          :  3306
 Database username      :  username
 Database name          :  dbname
 PHP configuration      :  /etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /usr/local/bin/drush
 Drush version          :  8.1.9
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /path/to/root/folder
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default

The issue is when trying to load the website I get :

PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'ip-address' (13) in lock_may_be_available() (line 167 of /var/www/cw/html/includes/lock.inc).

Any idea why this is happening ? If I run drush sqlc I'm able to connect to the remote database.

Any help will be much appreciated.


texts: Caption field with default value inside CKEditor

texts:
I activated the caption filter under Text format configuration to add description to media inserted via CKEditor

Is there a possibility to add a default value to this caption field whenever I add a new media inside the WYSIWYG editor?


texts: Forbidden 403 http request using deployment module

texts:
When I use the deployment module on my local websites it works perfectly, I make a devlopment plan, add one or more endpoints, I select some nodes and then I deploy the plan and run Cron.
This way nodes that I selected are copied to my other sites in the multisite set-up.

When I use the exact some set-up for my live websites I get this error when executing the Cron:
Link to image: http://imageshack.com/a/img401/5973/bwju.png

This has to be something with the permissions when I look it up on the net but I cannot find a solution.
Link to module: https://drupal.org/project/deploy

Is there anyone that has tested this module and had the same issue and fixed it?
Or is there someone that can tell me what to fix to make it work?

Thanks in advance


texts:
I'm in the middle of a D7->D8 migration and tried running the command drush migrate-messages but got the following error:

ArgumentCountError: Too few arguments to function drush_migrate_tools_migrate_messages(),
0 passed in /mysite/vendor/drush/drush/includes/command.inc on line 422 and exactly 1
expected in drush_migrate_tools_migrate_messages()

but I've never had this error before running the same command and can't find anything in the documentation about it.


texts: Can't install module Webform because more than 2MB

texts:
I keep getting the error that the file exceeds 2MB and that that is the maximum allowed. This is when I try to upload it.

For now it only happens with the module Webform for drupal 8.
Is there any way I can compress this so that it is not too big?

Or how do I put it in manually if there is no other way?


texts: Why isn't the mini-panel I've created appearing as a panel I can add?

texts:
I've made a mini-panel and placed it in a category. Now I want to add my mini-panel to a panel page. Only, when I go to add the component I don't see my mini-panel anywhere.

I tried changing it to a different category, refreshed cache and rebuilt registry but theres no change.

Would anyone know what I could do?

(this is in Drupal 7)


texts: Users with no roles are getting onto my system

texts:
I am having an issue with my site, there are users accessing it and creating accounts without having a role.

Here we can see user roles is blank. From my understanding someone has found a weakness in our system and has exploited it to create accounts with no roles.

since the account has no role does this mean its not subjected to the rules of any role? Do these accounts have admin access to our site or would it be closer to anon users.

Is there any basic thing that I could do to stop people with no roles getting in? Or is there a way to see how a user with no role is created (understanding the process would help me fix the problem)?

Edit 1

Version: Drupal 7

Module: User 7.32

Module: LoginToboggan 7.x-1.4


texts: How to update the configuration set by one module in another module

texts:
I have a custom module which defines configuration for blue_article content type using the following file:

modules/custom/blue_article/config/install/node.type.blue_article.yml:

langcode: en
status: true
dependencies:
  module:
    - menu_ui
third_party_settings:
  menu_ui:
    available_menus:
      - main
    parent: 'main:'
name: 'Article'
type: blue_article
description: 'Standard article for Blue sites'
help: ''
new_revision: false
preview_mode: 1
display_submitted: false

However I have another custom module which provides configuration settings for Workbench Moderation module.  The idea is that if I enable this module, then the 'blue_article' content type should be updated to include the workbench moderation settings.  I have added a configuration file to the blue_workbench_moderation custom module.

modules/custom/blue_workbench_moderation/config/install/node.type.blue_article.yml:

langcode: en
status: true
dependencies:
  module:
    - menu_ui
    - workbench_moderation
third_party_settings:
  menu_ui:
    available_menus:
      - main
    parent: 'main:'
  workbench_moderation:
    enabled: true
    allowed_moderation_states:
      - draft
      - needs_review
      - published
    default_moderation_state: draft
name: Article
type: blue_article
description: 'Standard article for Blue sites'
help: ''
new_revision: false
preview_mode: 1
display_submitted: false

If I enable the blue_workbench_moderation module after the blue_article module is enabled, I get the following error:

Drupal\Core\Config\PreExistingConfigException: Configuration objects (node.type.blue_article) provided by blue_workbench_moderation already exist in active configuration

How can I resolve this? What is the recommended method of updating the blue_article content type configuration to include workbench moderation settings when I enable blue_workbench_moderation module?


texts: How to add CSS class to password-strength and password-confirm on /user/register page?

texts:
I want to add a class to password-strength and password-confirm on /user/register page? I tried to alter the form but as these are made with js I could not change or add anything to them.
How can I alter these?


texts: Manage display at entity reference field Drupal

texts:
I have created two content types A and B.I have a date field in A which is referred in B. But in B I want to display the date field separately.

i.e 3 Different select list for month, year and day.


texts:
I have a question regarding filtering in Views.

My setup:

• I have a content-type, for example: Cars
• I have a few different taxonomy term fields attached to that node, something like: Car brand, Car color, Car type, with the following terms:

  Vocabulary: Car brand

  Term:Car Brand A
   Term: Car Brand B
    Term:Car Brand C

Vocabulary: Car color

  Term: Blue
   Term: Red
    Term: Black

Vocabulary: Car type

  Term: Two seater
   Term: SUV
    Term: Sedan

I have a View that displays all the available cars, and I used Better Exposed Filters to display a block that displays those taxonomy fields as filters. Now: this is were I get stuck.

Say for example, that 'Car Brand A' only only sells Blue and Black Sedans. What I would like is that the color option 'red' and car types 'SUV' and 'Two seater' are hidden as selectable option, and re-added if a user selects other brands. How do I do that?

I really hope you can help me with this! :)


texts: How to import csv file for "field collection" using feed-importers

texts: In Drupal7, In node processor settings -> we can't map field collection values. However they are multiple values, Is there any way of possibilites to import data through CSV file. I tried using field collection feeds module, In Processor Settings -> I selected "Field collection processor", then alert error is dispalying as shown "Missing Feeds plugin FeedsFieldCollectionProcessor". Is there any other way to solve this issue?


texts:
On my ajax submit form I would like to rebuild the form and show a dialog.
Here's the code I have used.

public function buildForm(array $form, FormStateInterface $form_state) {
if ($some_condition == false) {
    $form['play'] = [
      '#type' => 'submit',
      '#ajax' => [
        'callback' => '::play',
        'wrapper' => 'play',
        'effect' => 'fade',
      ],
      '#value' => $this->t('Play'),
    ];
  }
  else {
    $form['unplay'] = [
      '#type' => 'submit',
      '#ajax' => [
        'callback' => '::unplay',
        'wrapper' => 'unplay',
        'effect' => 'fade',
      ],
      '#value' => $this->t('Unplay'),
    ];
  }
}
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';

return $form;
}

public function play(array $form, FormStateInterface $form_state) {
  $ajaxResponse = new AjaxResponse();
  $ajaxResponse->addCommand(new OpenModalDialogCommand('test', 'asd', ['width' => '800']));

  return $ajaxResponse;
}

With the code above I am able to show the dialog but I am not able to rebuild the form.

So I have to use

public function play(array $form, FormStateInterface $form_state) {
      $form_state->setRebuild();
      return $form;
    }

But I will not be able to use AjaxResponse(); in this case.

How can I rebuild the form and show a dialog on submit?

Thanks in advance.


texts: How do I find what content is supplying my current page?

texts: I have a webpage on my site that doesn't have edit tabs, so I am not sure where this website is retrieving content. How can I find out what content represents this webpage? I am using Drupal 7.


texts: How can I determine which module is associated with a field plugin?

texts:
I'd like to implement an entity hook, and act on all fields defined by Computed Field FieldType plugins.  So I either need a list of all FieldType plugins provided by the module or need to know which fields are associated with it in order to know which fields to work on (or avoid).  Is this possible?

I'd rather not hard-code the list of plugins (computed_string, computed_decimal, etc.) because new ones could be added later, and then the list would have to change.

And I can't use computed_* because another module, Computed Field Plugin, defines its own field type with that prefix, and I don't want to touch it.

I was expecting something like FieldDefinitionInterface::getDefiningModule(), but that doesn't seem to exist.

For those interested, I'm working on adding support for computed cardinality.


texts: How to redirect a module button to a specific external Url

texts:
I'm trying to make a button type to redirect in an external Url and I don't know how to make it.
I already make the simple Form and I need help for make this function.
I'm using Drupal 8
Thanks in advance


texts: After uploading an image, it is re-sized to a width of 904 pixels; I need to keep the original file (1080 pixels).


texts: Stop pages being accessible via index.php/XXXX

texts:
I have a Drupal 8 (served via Apache) site with clean URLs enabled, however, I'm having an issue where every page is accessible over two URLs, for example example.com/index.php/example and example.com/example.

I would like to redirect the URLs containing index.php to the other URL. I'm also open to suggestions to completely disable pages being served over the first type of URL.


texts: Open Outreach distribution image not displayed & unable to upload new image

texts:
I installed Open Outreach via Acquia Dev Desktop on my Win 7 machine.

I am using Firefox, but the problem is also present in IE.

I deleted the second sample blog entry that came with the distribution. When I click the remaining blog (Welcome to our new website) the image that shows on the home page does not show on the blog page. Furthermore, when I attempt to upload a new image (after deleting the old one) I get a "Destination *" message, but no box to type in next to it. When I click Next I get "An illegal choice has been detected. Please contact the site administrator.".

In the message log I see the following.

Illegal choice public in Destination element.

http://openoutreach-7-x-1-19.dd:8083/media/browser?render=media-popup&types%5B%5D=image&activePlugins=&enabledPlugins=&schemes%5B%5D=public&schemes%5B%5D=private&file_directory=&file_extensions=png+gif+jpg+jpeg&max_filesize=&uri_scheme=public&min_resolution=&max_resolution=1000x1000&plugins=undefined

I am a newbie. Can you give me simple instructions as to how to fix this?

Thanks!


texts: How can I change the name of migration database in database array?

texts:
For a Drupal migration from d7 to d8, I have to define my source database to be called 'migrate' in the settings.php as below. My question is: how can I define the source as something other than 'migrate',  where is that set up?
`$databases['default']['default'] = array(
  'database' => "db",
  'username' => "db",
  'password' => "db",
  'host' => $host,
  'driver' => "mysql",
  'port' => $port,
  'prefix' => "",
);

$databases['migrate']['default'] = array(
  'database' => "drupal7",
  'username' => "db",
  'password' => "db",
  'host' => $host,
  'driver' => "mysql",
  'port' => $port,
  'prefix' => "",
);`


texts: How to make highlighted region to appear above the sidebars

texts: I am creating a sub theme from Zen Starter Kit. How do i Enable the highlighted region to appear above the sidebars. I want to place a slide show there. I am able to do so but then when i place content into my sidebars they appear below the slide show...Please help..what changes or additions to i need to do in my theme files and where and which files


texts: Rules to clear commerce cart on adding new item of a different product type

texts:
I've several product type with corresponding product displays. The scenario is a case where there is only a product type per time on the cart. That is, you cannot  have multiple product types at the same on the cart. Hence, each time a new item is to be added, check if it is of the same type as the existing items in the cart. If it is add, if not clear cart before adding the new item.

What rule setting can help me in achieving this. Thank you.


texts: i want to disable the cloud zoom module in drupal commerce kickstart

texts:
I am using Drupal Commerce kickstart. I including the demo site also. Cloud Zoom not working properly in my site, Please any one guide to me. I am new to Drupal commerce kickstart. I am using Drupal custom html theme convert to the Drupal theme.
Cloudzoom module installed in core.
I can't disable it.


texts: views query alter not working when view appears in sidebar

texts:
I have a block view, and I want to change my query, to add contextual filter. I made a views query alter but when the view appears in sidebar as block view this function doesn't work.

function bpm_views_query_alter(&$view, &$query) {
   if ($view->name == 'single_job' && $view->display_handler->display->id =='block_1' ){
      $nid = _get_job_nid_from_url();
      $query->where[1]['conditions'][2]['value'] = $nid;
   }
}

If I add the same block view in page content then views query alter work as expected. The page is created by page callback and this is following code how i add block view in page content

$output = views_embed_view('single_job', $display_id = 'block_1', $category);


texts: force a different page template based on node id?

texts:
Is it possible provide a page with an alternate template suggestion for a certain page?

e.g. i have a landing page. I have the node id. I would like to switch the page template if the node id is a certain number.

If it is how would you go about that in the theme preprocess function?


texts:
I am trying this code

   echo "<select>" .$main_nav = menu_tree('secondary-links');

            print"<option>"     .    $main_nav   . " </option></select>";<br>

but it display all menu at ones


texts: How to filter view by actual name of logged in user matches field?

texts:
I'm using Drupal 7 and latest Views. I have a static field set with a variety of names, for a specific view I want to filter if the name of the logged in user matches the actual name of logged in user.

For example if logged in user is "Jean Claude" and I have a field with:

Big Sky,
Orange Cat,
Jean Claude

I would only want to display the content the field set to Jean Claude.


texts: is there a way to overwrite the views Sort criteria?

texts:
i have overwritten a field's output, and want to use it as the Sort criteria. so i must overwrite the Sort criteria?  is there a way to overwrite the views module Sort criteria?

the sort criteria is:

table votingapi_vote, the field content_id,which is $node->nid, the vaule=1. i want to to sort it by the number counts of the vaule. desc. HOW TO do it?

if i want to alter the  sort criteria in the template.php, is there a way to get it?


texts: Is it possible to call response()->setStatusCode() within hook_theme_suggestions_page_alter?

texts:
We set up a custom error page theme by creating a block with the error text and then used the following code within a hook_theme_suggestions_page_alter implementation to determine when to override the template and show that "Page Not Found" block:
// error page template suggestions
if (!is_null(Drupal::requestStack()->getCurrentRequest()->attributes->get('exception'))) {
  $status_code = Drupal::requestStack()->getCurrentRequest()->attributes->get('exception')->getStatusCode();
  $suggestions[] = 'page__error';
}

Now it turns out that due to some hosting constraints we need to be able to serve up a version of the "Page Not Found" page with an HTTP status code of 200. So, is it possible to use response()->setStatusCode() within hook_theme_suggestions_page_alter? I was hoping to just override the status code for a single arbitrary route, but so far my attempts to call it from there have been unsuccessful.
Admittedly, it would be a hack to call it there even if I can, but I wanted to check before reverting a bunch of theming code.


texts: Cannot access Administration > People page

texts:
I cannot access the People page.  There is no error message.  If I click on People in the menu bar, the Administration home page is shown.

The other Administration pages are accessible.

Similarly, if I click on Permissions for any module, I get the Administration home page; not the Administration > People page.

The User module is enabled.  I am logged-in as user #1.

I have checked the .htaccess file and do not see anything that would cause a problem.

I have tried disabling the handful of modules I have added.

What should I do next?


texts: Custom "Panels" User Dashboard not showing

texts:
I cannot for the life of me work out why my custom Panels user dashboard are not showing once a user (Role) has logged-in. Instead of showing the relevant Panel Variation based on the said User Role, post-login simply shows the main Profile tabs irrespective of whether I'm Admin or any other 'Test' role user (there are 5 different Roles, so a different Panel Variation for each Role).
The Role Criteria is set in the Panel Variation and a Rule tell the system which Pane to show. I've also tried this with a Homebox model and still get the same Main Profile tabs showing; I don't know why or what influences the Tabs to show and cannot find any tutuorials online to explain why or if it's something I'm doing wrong or its 'bug'.

To recap, I'd like to ensure that a Users Dashboard (D/B) IS THE MAIN page show when the user has logged in (ala Drupal.org user home D/B).

Would anyone like to shed some light on the generalisation of acheiving what must be a simple workflow task?


texts:
I am trying to modify the 'has_js' cookie that is set by Drupal. I need to modify this cookie so it becomes both  Http-only and secure in response to a site security review.

I attempted to add the following to the html.tpl.php file so the cookie would be modified before any output was rendered:

setcookie('has_js',null,null,null,null,true,true);
setrawcookie('has_js',null,null,null,null,true,true);

This gave me 2 has_js cookies, one with the desired modifications and one without.

I next attempted to grab the value from the original has_js cookie and then destroy it and replace it:

if(isset($_COOKIE['has_js']))
{
  $has = $_COOKIE['has_js']; //save cookie's value (i.e., '1')
  unset($_COOKIE['has_js']);
  setcookie('has_js','',time()-3600); //destroy old cookie
  setcookie('has_js',$has,null,null,null,true,true);
  setrawcookie('has_js',$has,null,null,null,true,true);
}
else
{
  print_r("Not set");
}

This demonstrates (by the output I get) that at the start of html.tpl.php, the cookie isn't set -- which might explain why there are 2 cookies (perhaps I was creating a has_js cookie at one point in time and after that Drupal creates its own). Confusingly, if I simply do

print_r($_COOKIE);

at the same place in the file, 'has_js' cookie does show up with an assigned value of 1.

So my question is:

How can I find out when Drupal is setting this 'has_js' cookie and how can I add these attributes to it?


texts: How to style and add more fields to the bubble in a gmap field?

texts:
I'm using gmap field, it displays only 1 bubble at the same time. If I click on bubble it displays title.

How can I customize it? I need to style it and add more fields to it.

I know how to do it using view (than I can do template for it), however in this case I have only gmap field that display itself.

I want to get this result:


texts: How to allow users programatically to post and view posts regardless of they are trusted contact or not in drupal commons

texts:
All is in the title, actually users can only posts privately to theirs trusted contacts and sees posts of trusted contacts.
I don't need such restriction in my project and want to bypassing this restriction so all users except anonymous can posts and see posts.

That beeing said, I don't wanna change they way groups works, so if group is private all posts in the group should stay private.

I've searched in commons_trusted_contacts module and I can't figure out where this is been handle.
I've tried to set group_content_access value to 1 in database (1|Public - accessible to all site users) but this doesn't seems to be the way.


texts: loading newer jquery with hook_js_alter() breaks file upload on node edit form

texts:
I'm using hook_js_alter() in my theme template.php to load jquery 1.7 to my frontend only, and I've noticed that doing this breaks filefield uploads.

More specifically, once you select a file and click upload, the file will upload but the spinner just keeps looping.  If you click preview during this, then after the refresh you'll see the link to the file and the "remove" button.  If you click remove here, you'll see the same issue with the spinner continuously looping.  Hit preview again, and it'll refresh with the file removed.

I tested this method with jquery 1.5.2 as well and had the same problem, so its not a jquery problem.

This problem does not exist if using the dev branch of jquery_update module to load jquery 1.7.  But the issue with using this is it breaks field_ui and views functionality, so is not an option.

My code (very simple) is as follows, any ideas?

function mytheme_js_alter(&$js) {
    if (isset($js['misc/jquery.js'])) {
        $jsPath = 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js';
        $js['misc/jquery.js']['data'] = $jsPath;
        $js['misc/jquery.js']['version'] = '1.5.2';
    }
}


texts: How to debug or explore an unknown object or array too big for Drupal's debug()?

texts:
I'm trying to see what variables I have available in a $vars object in a Views hook. Unfortunately, like many Drupal object, this one is huge and attempting to output it using the Drupal debug() function (with or without the 3rd boolean argument) causes the server to crash with an out of memory error.

Note that this is after increasing the memory limit quite high, the memory limit isn't the problem here (UPDATE: I later discovered the array output was over 370 megabytes!).

What's the least intensive (fewest contrib modules, patches, custom code, 3rd party libraries etc) way to explore the contents of a Drupal object like this that's too big for Drupal's debug()?


texts: An error upon using entity reference field with data created with view

texts:
Today I have faced with an error which shows up when I use an entity reference field with data created with view.
Namely, I need to output a list of cities with their countries and regions.
That is, for Moscow I need to output "Moscow Moskow region, Russia". And so on.

For example, there are cities from my view.

Капернаум Израиль
c. Радонеж Московская область, Россия
Таганрог Ростовская область, Россия

I managed to create a view with display "entity reference" and the preview shows it correctly.
But, when I'm trying to use this field on my insert/edit node form in autocomplete mode, for unknown reason only city name shows, without country and region name. Moreover, the showed city name is not plain text, but it is a link to a node where this sity is saved (see the screenshot).

Could you clarify me, why city is showed without country and region and with the link to the node ? Is it a bug ? Or am I mistaken somewhere creating the view ?


texts: How to hide block while field in database is empty?

texts:
I have 2 blocks for the same content type (Banner):

block 1 = filter criteria : field video:input(not empty)
block 2 = filter criteria :

field video (is empty)
field image (is not empty)

What I want :

if field video is empty : show only block 2 and hide block 1
if field video is not empty : show only block 1 and hide block 2

Any suggestions how to make this work?


texts: Display a node form in default theme for admin

texts:
I think this question has been asked many times, but I am sorry not to find a working solution. May be I am doing something wrong. I want to display a specific node form in my default custom theme and not in the admin theme when the administrator logs in. However, other node forms should continue to display in the admin theme. Hence the "Use the administration theme when editing or creating content " should be checked.

I have tried the themekey module. I came across that there's something called themekey compatibility by which this can be achieved. But I fail to find an example.

I want the default theme for a specific content type. Also I tried the followings: hook_custom_theme & hook_theme_init as described in How to change the theme for a particular admin page in drupal?

Thanks


texts: How do I avoid having to clear the cache when changing a module configuration parameter?

texts:
I have a simple configuration parameter for a custom module. I use this parameter to decide how to render a field using a custom render element:

class Jmol extends RenderElement {

/**
 * Define the available options for our new render element.
 */
public function getInfo() {
$class = get_class($this);

// Produce the default settings for our render element.
return [
  '#pre_render' => [
    [$class, 'preRenderJmol'],
  ],
  '#version' => NULL,
  '#theme' => NULL,
  '#id' => 'mydiv',
  '#info' => [],
  '#attached' => [
    'library' => [],
  ],
];
}

public static function preRenderJmol($element) {

// Examine the config file to see which library version to use.
$config = \Drupal::config('jmol.settings');
$version = $config->get('version');
// Look at the element to see which version the user would like to use.
// They may have changed it from the default.
if ($element['#version'] != NULL) {
  $version = $element['#version'];
}

// The twig template to use.
$theme = "";

// Add the correct library to any the user has already provided.
$library = $element['#attached']['library'];
if ($version == 'full') {
  $theme = 'jmol_full_template';
  $library[] = 'jmol/jmol_full';
}
elseif ($version == 'lite') {
  $theme = 'jmol_lite_template';
  $library[] = 'jmol/jmol_lite';
}

// Only add the theme if the user has not specified one.
if ($element['#theme'] == NULL) {
  $element['#theme'] = $theme;
}

// Add the info array to drupalSetting so the JS can access it.
$id = $element['#id'];
$drupalsettings['jmol'][$id] = [
  'info' => $element['#info'],
];

$element['#attached'] = [
  'drupalSettings' => $drupalsettings,
  'library' => $library,
];

return $element;
}

If I visit the module settings page and change the value of the "version" parameter, my module continues to behave the same until I clear the cache.

The submit portion of my configuration form is:

/**
 * {@inheritdoc}
 */
public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::service('config.factory')->getEditable('jmol.settings');
  $config->set('version', $form_state->getValue('jmol_version'))
  ->save();

  parent::submitForm($form, $form_state);
}

Is there something else my submitForm function needs to do, or is there a different way I need to be reading the config parameter?


texts: Difference in form when first loaded and submitted

texts: When debugging commerce checkout panes, which are basically forms I see that form is loaded on page load(obviously). It is again loaded when I click submit and debugger goes through same lines of form, thing is I am not sure which marker to use to differentiate code when this occurs, I would need to do something different in this case, but only thing I see different is superglobals at this point, which I could use, but somehow I would be more comfortable using drupal local vars?


texts: Is it possible to restore a deleted node?

texts: While revisions are kept and it is easy to get back to a previous revision of a node, I was wondering if it is possible to restore a node that has really been deleted by a user?


texts:
I've created a Custom Field (let's call it 'Reference') whose value requires the Entity Id.

To accomplish that I modify the Field value in the postSave method, like this:

if (!$update) {
  $this->get('value')
    ->setValue($this->getCalculatedReferenciaValue());
}

public function getCalculatedReferenciaValue() {
  //...
  $entity = $this->getEntity();
  $id = $entity->id();
  $year = date("Y", $date);
  // default format: 'SWAN%s%08dIMOV'
  $format = $this->getSetting('format');
  return sprintf($format, $year, $id);
}

Then, in pathauto, I use that custom created field, as a token, to generate the path.

However, for some reason, when creating a node, my custom field still has the default value.

If I then edit and save the node, the custom field (and the auto path) is updated correctly.

Q: Is there a way to update the field value so that it becomes available when generating the autopath for the first time?


texts: Moving file structure and documents from Static site to Drupal

texts:
I have a static site that we have created content types for and moved most of the content over. There are links leading back to the old static site documents. I am looking for a good way to bring these docs into the drupal fold. I understand i'll need to update the path to the doc, but if we can keep the majority of the structure and just update to /default/files/directory/subdirectory/file.ext that would be great.

How does one most successfully import large amounts of documents?


texts: Render View with title in twig template?

texts: Is there a version of drupal_view (or alternative) that will render a view with the title? It's a pain to hardcode titles or preprocess individual views just to get a title to render that is already configured per display from the views interface.


texts: How to prepopulate drupal form and still execute a custom submit handler

texts:
I want to build a custom edit form for a existing node. The edit form should not show all fields and should be populated with the existing field values. Furthermore I want to add a few custom submit buttons. I know I can pre populate the fields with #default_value, but there are quite a lot of fields I have to pre populate like that, so I wanted to pre populate them all at once.

I have made a form function with the following code:

$node = (array)node_load($nid);
$form_state = array();
$form_state['values'] = $node;
$form = node_form($form_state, $node);
drupal_prepare_form('node_form', $form, $form_state);

I have also defined a custom submit button:

   $form['submit_one'] = array(
       '#type' => 'submit',
       '#value' => t('Gereed'),
       '#weight' => 10,
       '#submit' => array('custom_form_submit_one'),
   );

And a submit handler:

 function custom_form_submit_one($form_id, $form_values) {
   watchdog ("Hello","Hello");
 }

When I press the submit button, the submit handler is not called.

When I disable the statement:

$node = (array)node_load($nid);

and I press the submit button, the submit handler is called. However, my form is not pre populated with the values.

Is it possible what I want to do? Can I use a custom form and pre populate the fields (without specifying #default_value for each field)?


texts: Is there a tpl.php file generated by Drupal 7 for custom content types

texts:
I seem to remember it being mentioned somewhere in the past that when you create a new content type in Drupal 7 that there is a corresponding node--[content-type].tpl.php file created somewhere by Drupal core. I may be wrong. However, if there is such a file created, how do I find it so I can copy it in to my theme?

Maybe it defaults to the node.tpl.php file, but I thought a new file for the custom content was created. Just don't know where to find it if it is created.

TIA


texts: Strange question pertaining views as forms?

texts:
I am attempting to provide quizzes in Drupal. The Drupal quiz module is out of question as a version for Drupal 7 does not exist. The way to go about doing this then IMHO is using web-forms. I am treating each question that is part of the quiz as a separate node entity.

The idea is to cluster these questions based on taxonomy vocabularies and establish a quiz. Clearly the best way to have nodes together would be VIEWS with some filter criterion. However, this clearly backfires. It establishes the required set of questions as a view. But this does not necessarily establish them a single quiz form, but rather a set of individual forms all present in the single page. Essentially, if my view has 10 questions, then it has 10 SUBMIT buttons.

My aim is to try and create this view as a form, but I think that is not possible anymore. I feel I should just post this here, regardless to get an answer or alternative ways to go about doing this.


texts: How to expand NodeForm so new argument can passed to it

texts:
I have a content type called service request, which have some conditional fields that each might appear or disappear based on an other field value called service type.
I have used conditional field and they work just right but for better user experience I want node form to be called using one of the service types.
so I tried to follow this instructions provided by Jaypan to extend NodeForm, but when overriding form function of NodeForm, it leads to Error: Call to a member function getEntityTypeId() on null in Drupal\Core\Entity\EntityForm->getBaseFormId()
this is how I used to create $form:
class ServiceBuilderForm extends NodeForm {
  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state, $serviceType = NULL) {
    // Added as a fallback in case a developer uses this form without passing
    // $someId:
    if (is_null($serviceType)) {
      $form = [
        '#prefix' => '
',
        '#suffix' => '
',
        '#markup' => $this->t('Form is missing Service Type which is required'),
      ];
    }
    else {
      $form = parent::form($form, $form_state);
      // Do something with $form and $some_id
    }

    return $form;
  }
}

and in my Controller I have get my form using:
$form = \Drupal::formBuilder()->getForm('\Drupal\{my_module}\Form\ServiceFormBuilder', $serviceType);


texts: What settings from a zen sub theme are not saved as files?

texts:
Im duplicating a zen sub theme so that I can later modify the styling. Ive duplicated the theme folder and changed its name. Ive changed the .info file name, and ive changed the theme name for theme overrides in my template.php and theme-settings.php.

When I enable the new theme its very much like the old one but there are still some differences. Ive looked at the theme settings pages in drupal and applied the settings from the original theme to the new one, but there are still some differences.

What other settings to do with the theme would not have been copied across with the files and also arn't visible on this page?

The only module that Ive found that I think could be affecting the layout is Panels which controls a couple of pages. Ive changed the selection criteria from themeA to themeB so I dont think its this module causing the difference.


texts: How do you provide conditional checkout options depending on whats in the cart?

texts: Is it possible to provide different payment options depending on what is in the cart? Say someone wanted to purchase a service vs a physical product. For service related items, I want to be able to provide a payment option of Bitcoins and if its physical products, provide paypal. if they have a service and product in their cart it would only provide paypal as an option. Can this be done via rules and which rules would i need to edit?


texts: Listing Inventory items without being purchasable items

texts: The company website requires a list of large inventory items - engines, pumps, compressors, etc for the oil & gas industry. I was looking into UberCart but unfortunately it does not need to be an E-Commerce platform. What is the most efficient way of displaying inventory items in Drupal 7?


texts: form Class, add a check function before the buildForm method

texts:
I generate a sample Class form (and routing) with the drupal console.

Then, I have my class with some defaults generated methods ; getFormId, buildForm...

When the user go to the url path defined in the routing file, the buildForm method is called for build the the form.
I want call another function for check some datas before the buildForm method :

I function like :

function a_check_function_or_method_before_buildForm(...){
    // - Check some datas
    // - If all is ok, the buildForm can be called
    // - Else, if the custom function detect an error, the buildForm isn't called and the user is redirected to an error page
}

Is it possible to do that ? how can I do that ?

Thank you =)


texts: How to display only one Commerce product variation in Views?

texts:
I have a view which displays the list of all Commerce Products on the site.

The problem is that it displays variations as separate products.

I've tried:

Enabling Views aggregating checkbox
Creating a new view which is based on nodes, instead of Commerce Products
Checking "Distinct" under "Query options"

However, neither of that worked. I'm not sure if I misconfigured these settings.

I suspect that it has to do something with aggregation/grouping but I can't figure it out for a couple of hours already :@

How can I limit the display of products to only one variation?

Thanks!


texts:
Is there any way for sending code by SMS when the user login to the website "OTP", I want my website more security for login, the users have to type Username,password, SMS code.

Thanks for your support,


texts: How to compare with a rules condition vote:uid to 10 instances?

texts:
Principle: limit user's votes to 10.

Modules used: Voting API, Rate (or maybe Plus1)

Context: Users can vote on projects with 10 possible votes to distribut on all projects, by 1 to 10 votes on each project of their choices, up to a total of 10 votes.

When a user has distributed 10 votes, he loses the permission to vote.
To swith the permission with rules, I create a role "Voter". All users have the role by default.

At that point, I have this:
- Event : content is viewed (of type project)
- Condition : site:current-user:uid equals vote:uid
//And now I'd like to say something like "AND vote:uid appears 10 times in the 'votingapi_votes'.'uid' SO
- Action : Add/remove user role to simple AU (without vote permission)

So how to compare with a rule condition vote:uid to 10 instances?


texts: how to display entity references as numbered list?

texts:
I'm selling music albums in Commerce. The product type has an entity reference field with unlimited values for the content type 'tracks' which I'm using to display the tracklist of an album. I'd like to output this field as a numbered list so the track I reference are displayed like this:

track title
track title
etc.

I also need to be able to export the track number from a View via Views Data Export.

Any ideas as to how achieve this?


texts: Edit field in content type after creation

texts:
I want to edit a field from a content type after the content type is created.

I'm using hook_entity_presave to alter some things before it's saved and hook_entity_insert trying to edit a field that was created via the previous hook.

The code looks like so:

function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
  $node = \Drupal\node\Entity\Node::load($entity->id());
  $link = $node->get('field_evaluation_link')->value . '&qid=' .  $entity->id();
  $node->set('field_evaluation_link', $link);
  $node->save();
}

The hook is called properly. The problem is that it doesn't save the newly edited value in the field_evaluation_link.

I'm very sure that I'm not doing something properly and at this point I'm out of ideas.

Any pointing in the right direction is greatly appreciated.


texts:
What's the best way to include views contextual filter pages to sitemap?
I need the sitemap and all my pages submitted to Google WMT.

What I have right now is a node type Book and a node type Author. I have managed to build a view that takes all the books belonging to an author in a structure like /node/%/books, where the contextual filter is calling the NID type Author with a relationship given by an entity reference, from Books to Authors.

For Drupal 6, there was a module here, as suggested here. For Drupal 7, it doesn't work.

Thanks!


texts:
I got a template for drupal 8 and modifying a content type, when editing a new field, it does not show up.

I'm attaching the images of the structure (fields, form display, display), creation of content and impression.

For more that adds any field I do not manage to make it visualize at the end, in web portal

AND, As in the last page of print (celestial circles) I can not edit that, for more that I have edited in: filds, form display and display. Please where else is it that you can edit these texts in drupal 8?

Can someone help me please

regards


texts: Converting hard-coded menus to using the Menu module

texts:
I have a site built in Drupal 7 with the navigation hard-coded in template.tpl.php. How do I go about switching this over to use the menu module instead?
I've already have the menu recreated in the site's main menu. How do I make my theme display the Drupal menu rather than my hard-coded one?
Is it correct to copy my current theme, create a new theme from that, swap out the hard-coded menu with some PHP code (where do I get that?), adjust the styles, and then activate the new theme?

One thing particular to my theme is I have menu drop-downs (secondary menus) that display when you mouseover the primary-level nav using JavaScript image swaps. I would have to recreate this menu in CSS.


texts:
Users can enter links in separate fields that lead to their facebook, youtube pages.

On output i would like to use images for those fields instead of showing ugly links.

Is there a module to acomplish this ?


texts: How to print external html output in form_submit

texts:
I have written a form that accepts user's input and based upon the input queries an external site and extracts the html of the result page from the external site. Is there a way to print html inside the form submit so that the results would appear on my drupal site. Following is my form_submit. (Drupal 7 is the version that I am working with)

   function tripal_search_form_submit($form, &$form_state) {
    //debug($form_state);
    switch ($form_state['triggering_element']['#name']) {
     case 'submit':
     $string=$form_state['input']['string'];
     $organism=$form_state['input']['dropdown'];
     $some_var = file_get_contents("http://legumeinfo.org/gb2/gbrowse/$organism/?q=$string");
     print $some_var //This is were I need help
     break;
     case 'reset':
     $form['items']['name'] = array(
     '#type' => 'markup',
     '#value' => '<input class="form-button" value="Reset" type="reset">',
     '#weight' => 2000,
    );
   break;
  }
}


texts: Taxonomy term view - show node fields in the view?

texts: Ive enabled the default view 'Taxonomy term' which overrides taxonomy term pages. How can I add fields for my nodes? Currently it says 'The selected style or row format does not utilize fields.' Thanks


texts: How can I provide a filter with context/nid of node invoking?

texts:
I'm currently working on a custom module that has a filter that requires the node object for the output.

Originally the filter was simply pulling in the NID from arg(1) and using that to load in the node object, but unfortunately if the filter cache is flushed and the nodes rebuild their output from anywhere other than the node page itself arg(1) will not contain the NID and therefore the filter will break.

I'm considering putting the NID into the token that the filter converts, but obviously the NID would not be known during the creation of a node. It wouldn't be overly difficult to alter the token via hook_nodeapi() to insert the NID, but it seems like a lot of hastle.

Is there a simpler way to provide a filter with some sort of context so it can be aware of which node invoked it?


texts: Flag/Unflag Taxonomy term when updating Taxonomy field in user profile

texts:
I asked this question a few days ago: Send email to all users that are tagged with the same tag a node is when created

I decided to go a different route and use the flag and rules module to associate users with certain terms. If a node is created that includes a taxonomy term that a user has flagged, that user will get an email (the email part I have figured out via rules).

I am trying to use a taxonomy field on the user profile page to let people "sign up for (flag)" terms. I am able to get the terms flagged when a user updates their profile but I can not figure out how to unflag from the choices made on the profile edit page for that vocabulary if the user unchecks a term.

In other words, if a user checks a term "on" (selecting it to subscribe to) while editing their profile, it becomes a flagged term and they will receive notifications. If that user comes back and unchecks that term on their profile it is then "unflagged". I have the former figured out (with the rule posted below) but need help with the unflagging.

Here is my rule so far:

{ "rules_email_user_who_subscribe_to_forums" : {
"LABEL" : "Email User who Subscribe to Forums",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "flag" ],
"ON" : { "user_insert" : [], "user_update" : [] },
"DO" : [
  { "entity_fetch" : {
      "USING" : { "type" : "taxonomy_term", "id" : [ "account:field-category:0:tid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "site:current-user:field-category" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "drupal_message" : { "message" : "[list-item:tid]" } },
        { "flag_flagtaxonomy_term" : {
            "flag" : "forum",
            "taxonomy_term" : [ "list-item" ],
            "flagging_user" : [ "site:current-user" ],
            "permission_check" : "0"
          }
        }
      ]
    }
  }
]

}
}

Please let me know how I can be more clear with my question. I have been working long hours and I am out of it.

Drupal 7.65

Rules: 7.x-2.11

Flag 7.x-3.9


texts: Fiverstar that averages other fivestar fields

texts:
I have a fivestar field that needs to be an average of 5 other fivestar fields. I have read;

-Using Fivestar to get votes to show

-Combine Multiple Fivestar rating fields,

-Average Value of Multiaxes

None of those really walks you through the process of creating a field that will total all other votes. I need to pull the values from the database, average them, save that 'average' to the database so it can be searchable, and then display that average on the content type am rating.

Am using the latest Drupal 7, fivestar, votingapi, computed field, etc... I've tried many different approaches to this and the only thing that has come close was some custom php I wrote that gives me an average of all the other fivestar fields. The problem with that is it doesnt save into the database.

EDIT: This is the PHP code I use to display the average. Technically its an average of averages. But it works. Unfortunately, it doesn't store in the DB.

$total =
        $content['field_business_q1'][0]['user']['#item']['average'] +
        $content['field_business_q2'][0]['user']['#item']['average'] +
        $content['field_business_q3'][0]['user']['#item']['average'] +
        $content['field_business_q4'][0]['user']['#item']['average'] +
        $content['field_business_q5'][0]['user']['#item']['average'] +
        $content['field_business_q6'][0]['user']['#item']['average'];
        $total = $total / 6;
        echo "<b>Total Average:</b> " . $total;


texts: How to resolve conflict between zen theme breadcrumb function and Path Breadcrumbs?

texts: Apparently there Path Breadcrumbs module and the Zen theme's breadcrumb append title option have a conflict where the Path Breadcrumbs module overrides the theme's implementation of the breadcrumbs. Such that when the PB module is enabled, the theme's breadcrumb trail doesn't append the title to the breadcrumb trail. This leaves me with three options: 1) hack the theme breadcrumb implementation to re-add the titles, 2) implement views page breadcrumbs in code; 3) implement path bread crumbs for all of my pages. None of these options seems particularly pleasant, but I think approaching the theme breadcrumbs will be the least work. Any ideas? or simple workarounds?


texts: Wrong User Image Display - Weird Twig Cache?

texts:
I'm having a weird issue with incorrect user images being displayed and it seems to be a caching issue or perhaps I am passing the user image incorrectly to my template.

Problem: If I login to a different user account I will still see the image from my account. If I rebuild the cache and then refresh the browser, I will receive the correct user image.

Am I building the user image incorrectly?

mytheme.theme

 <?php
  use Drupal\user\Entity\User;

 function gary_preprocess_block(&$variables) {
  $user = User::load(\Drupal::currentUser()->id());
  $file_uri = $user->get('user_picture')->entity->getFileUri();
  dpm($file_uri); //correct uri
  $styled_image_url = ImageStyle::load("user_pic")->buildUrl($file_uri);
  dpm($styled_image_url); //correct url
  $picture = $styled_image_url;
  $variables['user_pic'] = $picture;
 }

block--gary-account-menu.html.twig

The variables in the theme file are correct, but the output from twig when inspected, continues to give the wrong built url to the previous user image (until the cache is flushed).

I doubt I need to delete twig cache or flush caches anytime a user pic is changed or account is switched. Anyone know what I am doing wrong here?


texts:
I'm using Views 7.x-3.11 with Better Exposed Filters and Ajax auto-submit in a panels page, and running into some issues that seem to be stemming from code in Views/js/ajax_view.js. I want to make the exposed filters bookmarkable, and I also need to deep link to certain result sets. Because of this, I added some custom js to add the selected form parameters to the URL as the user selects them.

I also have a section that lists all the currently active terms, where a user can click to remove them. In order to update the results from here, I'm calling $('.view-my-view').trigger('RefreshView');.

By default, from here I can see that the ajax_path for submitting the form has been set to the URL with the query string, which doesn't work. From what I can tell, the native ajax behavior is trying to submit the serialized form data to an already-parameterized URL. To change this behavior, at line 38 of ajax_view.js I've changed var queryString = window.location.search || ''; to var queryString = '';

It's pretty apparent that this is going to cause issues with some sort of intended functionality, but I can't determine what that is. I'm afraid I'm losing sight of something bigger-picture here, or not aware of something about how Views handles ajax submission typically.

Can anyone provide an example of a situation where you'd need the original code? Or what the intended purposed of it is?

Edit: Follow-up question that's a little more practical - is there a way I can make an equivalent change in my custom js that would override the default code in ajax_view.js, so that I don't need to alter the module?


texts:
I am using one of the packaged views that comes with the Views module titled 'Taxonomy term' to handle what product looks like when someone searches the taxonomy. Is there a way to grab the tid of the term being viewed from the theme page or node template file?

Edit: Maybe I should explain what I am trying to do. I have a couple of selectmenu (also created by views) that get the terms from a certain taxonomy grouping. When a user selects an option, it takes them to the Taxonomy term view. I need to be able to grab the tid so that I can make a new select menu out of the choice they made.

Application: Let's say a I have a bunch of products in a number of brands. Someone picks a brand. I need a new select menu created for all the product in that brand.

If there is a way to do this in views, that's fine, but if i had the tid, I could just make a module or a function that creates the select menu.


texts:
I'm trying to customize the user registration page in a zen subtheme.
The template candidates files suggested by themer devel are page-user.tpl.php and page-user-register.tpl.php, but when I try to create them, page.tpl.php (placed in the subtheme as well) is not overridden.
All other pages are working fine.
I've clean theme registry and checked all file permissions, I still can't get this.
What did I miss?


texts:
It's there a chance to retrieve all key/value, stored in variable table, that have a prefix, using variable_get()?
e.g: variable_get("prefix_*")

Or I have to use db_select('variable')?


texts: Long wait time for website and taking too much CPU+Memory

texts:
My drupal site is taking too long wait time, and it uses CPU + memory. My server setting is

16GB RAM, 8 processors. So it is good.

I am using Commerce Kickstart distribution have enabled 180 modules all are required cant disable a single module, I cant use caching coz content is mostly dynamic. My site loads in 8 second (most pages) in which wait time is only 6-7 seconds. Multiple hits takes CPU usage to 100%. I have checked reports with xhprof, top command on server, database tuning script, front page executes 4,52,600 functions, PDO commit taking 31% CPU, Database connections are not properly closed.

I have tried database tuniing module, database tuning script but nothing is working fine right now for me.

Cant use caching even default drupal views caching.

Please suggest some steps, any help will be a big big favor. Website i am building is dynamic so caching is prohibited.


texts: Unexpected session reset when making authenticated user REST requests

texts:
I am using Drupal 7 and Services module
To create endpoints for login and subsequent functionality exposed for logged in users
As noted here and here, the ideal workflow should be -- Make a POST request with username and password > to end point /user/login (the end point is already enabled) > return data contains Session name and Session id > you join both of them with an '=' in between to form the cookie > you send that cookie in subsequent requests in the request header > these requests automatically get treated as authenticated user requests > All is good
But in my case when I do the last step (send cookie in request header) something weird happens. The uid associated with that particular session in the sessions table is set to 0. (In effect the session is authenticated user session anymore, it is not destroyed either, it just goes anonymous)

I am really puzzled by this. I have replicated the behavior on multiple setups, and hoping that this is just a case of me missing something obvious here.

Any help would be much appreciated? Super many thanks in advance.


texts: how to know if a form_alter is being invoked through an ajax request?

texts:
I am altering a node add form using hook_id_form_alter and inside that i am doing a drupal_goto, if query parameter is missing a mandatory token value. Now, in the add node form, there is an image field. When i'm trying to upload that image, which is an ajax request without the token, the form_alter function is invoked and hence fails.

Any help is appreciated!


texts: Migrating from Postgresql 9.1 (non drupal) to Percona Server 5.5

texts:
We decided to go from a perl website to Drupal 7 (PHP 5.5.23).

My big question is how do i migrate the DB which is PSQL 9.1 to mySQL. I've heard of the Migrate module, Drush, MySQL Workbench.

Can someone direct me on which steps to take after converting my postgresql schema to  mysql?


texts: Auto-increment field based on value of another field

texts:
How can I have a computed field (field B) that has an auto-incremental number but  based on the value of another field (field A).

For example: I create a node with value "Location X" in field A. Field B should get value X001, I create a second node with value "Location Y" in field A. Field B should get value Y001. I create a third node with, again,  value "Location X" in field A. Field B should get value X002. And so forth


texts: What is the execution sequence of functions while rendering a form?

texts:
I have a form in my website with id: sample_test_custom_form. I have used hook_form_alter in a custom module  to alter this form. I also have a preprocess function (mytheme_preprocess_sample_test_custom_form) to do a little preprocessing.

However the alter function and the preprocess function are a little dependent on each other.

So I ask, what is the execution sequence of these function? Which of them is executed first?


texts: table media doesn't exist when accessing /admin/modules as /admin/content/media pages

texts:
When I try to visit /admin/modules/uninstall, or even /admin/media, the browser shows the following error:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.media' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM {media} "base_table" GROUP BY base_table.vid, base_table.mid) "subquery"; Array ( ) in Drupal\media\MediaListBuilder->getEntityIds() (line 158 of core/modules/media/src/MediaListBuilder.php).

I am currently using Drupal 9 and have no idea what this can possibly be.
Has anyone found and resolved this type of issue before?
I was thinking of manually creating the missing table, but I am not sure about the attributes information.


texts:
I want to improve the way I put my Drupal sites in production. For that I began to use 'Features' to export every single content type I created. (I'm doing it on the Drupal 6 websites).

But when I import those features on the production version of the website the only field I get is the title and other parameters. My field's from CCK are not exported.

I have the same module's (and version) on the local, staging and production website. All required modules are installed. During the generation of the 'Features' I added the custom fields I have created.

Has anyone experienced this behavior? Is there any solution? Did I forget something during the process?


texts: visually resize images when uploaded inline in ckeditor

texts:
is there a way to resize images after uploaded in the inline ckeditor?

if i have a big picture 2000x2000 and upload it (not via IMCE) to the editor, the image is huge and it is displayed in full size.

i have to scroll to left and down and drag the resize button multiple time until i get the result i can work with.

i miss the settings dialogue from D7 where i can define an image size upon upload. i cannot find any extension and i read many discussions that the D8 ckeditor has a lot less functions than in D7.
i read about the reason is responsive design but when i resize the image via drag there is still height and width added. so whats the point on this?


texts: Relate data in a custom sql table to a regular drupal field using views

texts:
I have a field collection, with a field "Attribute number", which contains a text value of the format "b1_a1", "b7_c2", etc.

I have a custom table that has a column that references an attribute number, and a column that contains a survey response value (yes or no).

I want to create a relationship between the attribute number field and my table, so that in views, I can list the attribute numbers, and display the corresponding response.

I'm looking at hook_data_alter().  There are example to extend a base table, such as node, and join with a new table, but there is no example to extend a non base table, such as my field_data_field_attribute_num.

How do I make a views join with a non base table?


texts: Are there conditions where invalidated cache items are returned?

texts: Why do we invalidate cache tags instead of clear cached items with those tags?  Under what conditions would the invalidated cache be returned?


texts: How to display image height and width in pixels?

texts:
I have image size, but I can't find any field for image height and with in Views.

I need to display orginal image height and weight, something like: Resolution: 800px x 600px.


texts: I get a "URL not found" error, but the image is on the server

texts:
I have a Drupal site which I have just migrated to a different Linux server for development. The site seems to be working more or less.

However, one problem persists: None of the images is shown. Instead, if I click on an image, it says: "Requested URL not found."

What is more, all of these images exist in the proper directories. I checked .htaccess for RewriteRules but did not find anything relevant. I have also played with permissions. Currently the entire root of the site is set to 755.

What can I do to make the images work?


texts: How to make sticky articles show up first in a list of articles?

texts:
I have a view showing a list of articles, sorted by date. I tried enabling the sticky article option in the publishing options. This made an article I had jump to the top of the list, but then a new article I added pushed the sticky article to second place.

I want a sticky article (pinned) to be first in the list even if I add new articles.

How can I achieve this?


texts: meta tags don't display when not authenticated

texts:
I'm using Drupal 7, Meta Tags/Open Graph meta tags 7.x-1.0-alpha6.

When logged in, meta tags act as I would expect. I see the meta tags when I view the page source.

When not logged in, the meta tags are missing. What could cause this?


texts:
How to hide path file in drupal? Now it looks like this:

http://localhost/drupal/sites/default/files/document.pdf

I want to change to look something like this:

http://localhost/drupal/media/view.php?id=6445


texts: view exposed filter ajax error coming for non administrator user

texts:
I have event calendar module which is perfectly working fine. For some other users (non-admin users) I have to give permission to access events posted by them (They have permission to view the calendar and add/modify/delete events).

So far everything is good. Now I added exposed filter(event status) which is working as expected while I logged in as admin.
Only when I login as user with some other role, I'm getting:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /views/ajax
StatusText: OK

Why is this happening only to non-admin user? I thought bypassing access control can give me some hint if its permission issue so I gave 'Bypass views access control' to that particular user role, still no luck. Any help greatly appreciated.


texts: Allow user to pick a number with each taxonomy term

texts:
Example:
I have several vocabularies each one representing animals:
First vocab: Dogs (child terms are breeds)
Second vocab: Cats (child terms are breeds)

So user for example has 6 golden retrievers, and he picks the term "Golden retriever". Now he should be able to pick how many he has, so i need a number to pick next to each term.

Is this possible ?


texts: How to set views configurations settings on custom module install?

texts:
I have a custom module. On its installation I want to set some configuration settings of views like:

ui.show.master_display
ui.show.sql_query.enabled

to TRUE.

For this I have added a file mymod_views.settings.yml to modules/mymod/config/install/.
the content of the file is:

ui:
  show:
    additional_queries: true
    advanced_column: true
    master_display: true
    performance_statistics: true
    preview_information: true
    sql_query:
      enabled: true
      where: above
    display_embed: false
  always_live_preview: false

But on the installation of the module I am getting the following exception.

exception 'Drupal\Core\Config\PreExistingConfigException' with message 'Configuration objects (mymod_views.settings) provided by mymod already
exist in active configuration' in
/var/www/drupal8/core/lib/Drupal/Core/Config/PreExistingConfigException.php:70

Can someone tells me how I will set these options through my module?


texts: Making an instantiated object in a module global

texts:
I am creating a Drupal 7 module, and i have a file with a class definition in it. I am able to instantiate this class successfully. Where is the best place to instantiate this class in my .module file and make that object available to my module hooks?

For instance, I don't want to do the following:

function mymod_block_view{
  $obj = new Object()
  ....
}

function mymod_block_info() {
...
$obj = new Object()
}

Normally I would just use dependency injection, but I can't add arguments to the function definitions (so far as I know)...How can I only instantiate my object once and get the members and methods of the instantiated object available to my hooks?


texts: The jcarousel module does not display image field

texts: I created a block through views page. The display format is jcarousel, the seclected field is image from a specific content type. It shows the empty field with an icon instead of images. If i add other fields like title... it is showing but only with image fields it has problem. The conteny type as well have many contents with images and texts.


texts:
How do I get the URL, not the link html for a taxonomy field in my view.

For Drupal 7 I found this ticket:
How do I get the raw URL as a field in Views?

This mentions getting the content: path - but this doesn't show up as an option.

--- Updated ---

I am creating a block view, not sure that matters. I have no path option, I actually am not seeing any content in the field type options.


texts: field_info_field API to get human readable name

texts:
We want get human readable name from field info API.
For e.g. in below API call
field_info_field('field_image')

From UI for Drupal to add Article as below:

Can we get this human readable names i.e. Title, Alternate Text etc from API.


texts:
I am having vocabulary containing hierarchical taxonomy like this :

Category1

subcategory1

lastcategory1
lastcategory2

subcategory2

category2

I am using pathauto to taxonomies path .

Path are like this :
www.example.com/category1

www.example.com/category1/subcategory1

www.example.com/category1/subcategory1/lastcategory1

At first path i want to show all subcategories taxonomy of category1 .

At second path i want to show taxonomy detail page of subcategory1 and below details i want to show subcategories  of subcategory1 taxonomy .

At last path i want to show content connected to lastcategory1 taxonomy .

How can i accomplish this using views .

Note : I don't want to change the taxonomy paths . I am using drupal 7


texts: How can I create correct breadcrumbs when using Views arguments?

texts:
I have a custom CCK content type for blog posts and I’m using Views to display the posts in an archived list. I use two arguments—Node: Created year and Node: Created month—to generate the monthly and yearly archive pages, which allows me to build URLs like http://example.com/blog/2011 and http://example.com/blog/2011/08. This is pretty standard stuff and really easy to do with Views.

While the actual archive list pages are working just fine, the breadcrumbs that views generates are not. With the URL http://example.com/blog/2011/08, instead of creating this kind of trail (which seems correct):

Titles = Home > Blog  > 2011       > August
URLs   = /      /blog   /blog/2011   /blog/2011/08

… Views generates this incorrect breadcrumb trail:

Titles = Home > Blog  > 2011  > August
URLs   = /      /blog   /blog   /blog/2011

The URL generated for the year argument points to /blog rather than /blog/[yyyy], and the generated URL for the month argument only points to the year, not the month.

Going down one level (to http://example.com/blog/2011) creates a similar problem:

Titles = Home > Blog  > 2011
URLs   = /      /blog   /blog

In both cases, none of the arguments' URLs are output correctly, while their titles are.

My settings for each of the arguments in Views are pretty standard: Month settings and Year settings. The path for the page display is just "blog".

What is causing this strange breadcrumb behavior and how can I fix it?

Thanks!