texts:
I want to create special menu items with title "Welcome ". I want to make it as special menu item (without link to any node), that shows sub-menu on hover. For that I have used Special Menu Items module and is working fine.

But I am not able to figure out how to create dynamic menu title in form
"Welcome Username".  I have tried using Menu Token module as well, but it didn't work. It just displays token as it is.

Any suggestion how can I achieve this using module or programatically.

-- Many thanks for your time.


texts:
I need to know of a way to manually order the articles displayed in the Drupal 8 front page by displaying a title between each piece. For example,

Title A

Article 2
Article 5
Article 3

Title B

Article 1
Article 7

I've tried configuring the front page view and looked into the Drupal 8 article and basic page settings but couldn't determine an effective way by which the above could be achieved. I also looked into whether there are any featured content modules available to suit my above needs but couldn't find any. And also the content needs to be able to be added to any page (not just the front page) as well.

If you anyone could point me in the right direction it would be greatly appreciated


texts: What is the best order of content deletion on Drupal sites?

texts:
Whenever I try to clean up a site.

I delete stuff in the wrong order, and then the site breaks.

Any guidelines on how to do this?

Content first, then content type? Blocks, views, what to delete first and in what order so things don't break?


texts: How to create "Custom Forms" that trigger own business-logic / do not create any Content

texts:
I'm new to Drupal, so sorry for this maybe simple question.

I'd like to create some kind of content-type, which a user can "create" and fill the forms, but instead of just saving the content to the database, i want Drupal to pass the values to a 3rd party software (which can be accessed by socket-communication), wich renders PDF's from the text the user entered.

The PDF should be displayed to the user after Form submission.

I know, i can use Drupal to render PDFs, but i want to connect to our legacy 3rd Party software.

So the question is: How and where can i hook-in to write my custom 3rd-Party socket-communication-phpcode and display the result to the user (or save it to drupal db, or, or, )?!

Thanks in advance!


texts: Drupal form ajax and select stylization?

texts:
I'm trying to make ajax select, but I'm using selectBox for form and I'm not doing click on form element. How can I done this?

$form['choice_wrapper']['format'] = array(
      '#type' => 'select',
      '#options' => $options,
      '#attributes' => array('class' => array('custom-text')),
      '#ajax' => array(
        'callback' => 'webform_technic_callback',
        'wrapper' => 'edit-choice-wrapper',
        'method' => 'after',
        'effect' => 'fade',
        'event' => 'change',
      ),
    );

Sctipt for selectBox:

jQuery("select.custom-text").each(function() {
                    var sb = new SelectBox({
                        selectbox: jQuery(this),
                        height: 150,
                        // width: 340
                    });
                });

And I have this code:

    <form accept-charset="UTF-8" id="webform-technic-form" method="post" action="/moy-ofis/moi-produkty/produkt-359-208/tehnicheskie-harakteristiki">

<select name="format" id="edit-format" class="custom-text2 form-select ajax-processed">
<option value="video">Video</option>
<option value="audio">Audio</option>
</select>

Video

Video

Audio

    ...
</form>


texts: List groups own content and all non-group content on groups page

texts:
I building a site where some content (eg. news, events) that either belong a group (region) or not (national).

On the national part of the site I have a view in a block that presents all content filtered by type (news or events). No problem...

On the regional part(s) of the site I want to have a view that show all the news (or events) that is published by that region. This is no problem either. (OG contextual filter etc.)

But I also want to include all news that don´t belong to a region at all.... this part I can´t figure out.

What I want to happen (under the hood) in the SQL is this...

The WHERE-part that I get from Views:

WHERE ( ((og_membership_node.gid = '<gid>'))
  AND (( (node.status = '1') AND (node.type IN  ('news')) )) )

Change that to:

WHERE ( ((og_membership_node.gid = '<gid>') OR (og_membership_node.gid IS NULL))
  AND (( (node.status = '1') AND (node.type IN  ('news')) )) )

Perhaps hook_views_query_alter() or hook_views_pre_execute() can fix this...


texts: Is there any way to create a discount that only discounts one product in an order?

texts:
We have a Drupal 7 site using Commerce and Discounts and we need to create a discount that will discount one product in the order by 100%.

Basically, we need to give a coupon discount for ONE free product but so far we only see a way to discount ALL products on the order or the entire order.

We've tried Commerce Discount EXTRA (module) and it gets close by using the "Per Quantity Product Discount" but it forces you to select one specific product that the discount would apply to instead of ANY product.

So, does anyone know of a way to achieve creating a discount to only discount ONE of ANY product in an order?


texts: Is it a good practice to declare drush as a dependency of a contrib module?

texts:
Is it a good practice to put "drush/drush": "^9 || ^10" in the required section of the composer.json of a contrib module if drush is actually its only interface?

I'm maintaining a contrib module, that can be operated only by using drush, but as far I saw in other similar modules (like: https://www.drupal.org/project/data_fixtures ) - drush doesn't appear in the composer's dependencies. Is there any reason for that other than maybe "crowd psychology"?

I'm just considering putting drush as explicit composer dependency of my contrib module.


texts: how to write web services CRUD operations for perticular Drupal content types

texts:
I have Installed following modules;

Services
Restful
Services view

Enabled these modules and created one services view for one content type(content type name: employees).

Then opened structure->services, created an endpoint and enabled view service(employee).

Service accessing Url Ex:  http://localhost:82/test/employees

Now data is accessing well.

But how can I do web services CRUD operations for this content type?


texts: How to re-write/rename HTML output of a View Block wrapper ID?

texts:
Drupal newbie here. Would like to know how do I change the HTML wrapper ID of a View Block?

Currently I have a view that has two blocks.

The first block is the "Do's" block.
HTML output:

The second one is a "Don'ts" block.
HTML output:

I would like to rename the "id" of the second block to make it more intuitive.

Screenshot: https://img.skitch.com/20120430-p8dtxdx7h8qa5augidx9gudjbn.jpg

How to do that? Thanks!


texts: I am setting up a shopping cart for a client and will host the new site on a separate VPS. What is the typical memory required to run a Ubercart site? We are targeting a few thousand users, around a hundred products, and under ten concurrent users.


texts: Edit Content with out seeing the information in text box

texts:
Let me explain this.
Lets say you have a form that you fill out to create a record.

In order to fill this form out you have to be registered and signed in.
Any one can sign up.

This form includes couple peoples addresses and names.

Now any one can go and edit the form where they can see the info on the form.

The problem is that when the form is filled out the first time or edited there is some fields that have personal information and i dont want public to see this data.

Does any one have idea how i can hide the information but have the info available to be updated if needed.

I was thinking using password type but it hides all of it.

Or maybe hiding part of the text ?

I have no idea how to go about this. If any one that reads this has any idea please let me know.

Thanks in advance.


texts: D7 to D8 users migration processes 0 items

texts:
I am working on my first migration from D7 to D8. I am trying to keep it very simple and start with users. I have created a custom module migrate_custom, created my definition at config/install/migrate.migration.d7cafe_users.yml:

id: d7cafe_users
label: User accounts
migration_tags:
  - Drupal 7
source:
  plugin: d7cafe_users
destination:
  plugin: entity:user
process:
  uid: uid
  name: name
  pass: pass
  mail: mail
  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  langcode: language
  init: init

Then I have my source plugin at src/plugin/migrate/source/User.php:

<?php
/**
 * @file
 * Contains \Drupal\migrate_custom\Plugin\migrate\source\User.
 */

namespace Drupal\migrate_custom\Plugin\migrate\source;

use Drupal\migrate\Plugin\migrate\source\SqlBase;

/**
 * Extract users from Drupal 7 database.
 *
 * @MigrateSource(
 *   id = "d7cafe_users"
 * )
 */
class User extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    return $this->select('dcf_users', 'dcf_u')
      ->fields('dcf_u', ['uid', 'status', 'created','access', 'login',    'name',
        'pass', 'mail', 'init', 'language']);
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    $fields = [
      'uid' => $this->t('Account ID'),
      'status' => $this->t('Blocked/Allowed'),
      'created' => $this->t('Registered date'),
      'access' => $this->t('Time of last access'),
      'login' => $this->t('Time of last login'),
      'name' => $this->t('Account name (for login)'),
      'pass' => $this->t('Account password (raw)'),
      'mail' => $this->t('Account email'),
      'init' => $this->t('init'),
      'language' => $this->t('language'),
    ];

    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
      'uid' => [
        'type' => 'integer',
        'alias' => 'dcf_u',
      ],
    ];
  }

}
?>

And finally I have a manifest.yml file containing:

- d7cafe_users

I run the migration with:

drush migrate-manifest manifest.yml --legacy-db-url=mysql://root:root@localhost/d7cafe

But all I get on command line is:

Running d7cafe_users                                                                                [ok]
Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'd7cafe_users'

I don't think I'm far off, as I could see running it and importing the 4 users from the legacy db, but did a bit of fiddling on the definition file and now I can't get it back to importing records. What is wrong with my code?


texts: How to assign default values to a Webform Structured Textfield?

texts:
Using hook_webform_component_render_alter() I am setting the default values for some components on a webform if a user has the corresponding fields in his/her profile filled out.

if($component['cid'] == 24){
    $element['#default_value'] = $myValue;
}

This works for every type of webform component thus far until I used a Webform Structured Textfield.

When I add the same code to the Webform Structured Textfield It only takes one digit from the number i'm assigning it. My input mask for the field is: 9999999 allowing the user to only enter 7 digits.

For simplicity sake, I have a variable: $myValue = 1234567;

When I assign the $myValue variable to the webform component the textfield will only show the value 1 instead of the 1234567. When I assign the variable to other webform components the value 1234567 is shown.

Is there anything I am missing or doing wrong when assigning default values to a Webform Structured Textfield? And if anyone knows any other ways to modify this field programmatically that would be sufficient as well.


texts: WSOD after migrating to another site? Troubleshooting a site migration

texts:
I'm in the process of migrating from one URL to another, and I've got a WSOD. What I had done is to import the new database from the production server.

I've copied all the files from another server using SCP;
I've then SCPed the database from the other server;
I have imported the database from command line;
I have changed the settings.php to the correct information.

I have the feeling it's something simple that I haven't ruled out.

Do you have any idea?


texts:
I have installed the *commerce_kickstart* install profile, and I am wanting to remove the Tax line item on the checkout page, and instead have some text instead that says VAT included (or in my Australia case, GST included).

Everything works well and as expected; however, my client would like to remove the line item for the VAT subtotal and just include text somewhere that says "All prices and totals are inclusive of VAT".


texts: Can we get full count of results from a query that is extended by PagerDefault

texts:
I have a query that is extended by PagerDefault.  I need to get the total count of results to show something like: "There are a total of 100 results, now showing 21-40".  I can't figure out where to get that number without building a separate query to run that doesn't use PagerDefault.

First place I looked was theme_pager(), which I'm already overriding in template.php.  The total result count is not passed there, only the current page (as $variables['element']).

I see that within includes/pager.inc in pager_default_initialize() only the current page number is sent to theme_pager, although the total items are passed to that function. (So close!)

Then I thought I could clone the query, but the query must be extended prior to adding conditions, so that wouldn't work.  I'll note that this isn't ideal either, because ideally, I would be able to get this total count without two db hits (as it would hit it for the count every time a user navigates the pagination).

So, does anyone know the best way to get the total count?

Thanks!


texts: Delaying form submission via Javascript doesn't work in IE

texts:
I have a form built for creating an instance of a custom entity. Upon submitting the form, I have a jquery script completing some actions on the page that need to execute before the form submits, so I attempt to stop the default event, perform those actions, and then resume the event as follows:

$('#submit').on('click', function(event){
    if (valid === true) {
        valid = false;
        return;
    }
    event.preventDefault();
    valid = true;
    //do some stuff
    $(this).trigger('click');
});

This works perfectly in Chrome, but unsurprisingly does not work in IE11. Through console logging I see that the re-click is fired, but the return line  simply does nothing, so the button click does not submit the form at all. I have tried some alternatives to $(this).trigger('click'); explained in a stackoverflow thread, but nothing is getting it to work.

The reason I'm creating a Drupal-specific thread about it is that I also tried  to skip re-firing entirely and just do a form submission like this:

$('#submit').on('click', function(event){
    event.preventDefault();
    //do some stuff
    $('form[data-drupal-selector="my-form-id"]').submit();
});

But this, for whatever reason, clears all of the data in any field collection items contained within the form.

Is there any feasible way to do what I'm trying to accomplish in Drupal that works in all modern browsers?


texts: image field “browse” button is not accessible

texts:
I have a strange problem with my web site. By add block I have an image field.
The "browse" button is not acccessible for some people.

I can click on "browse" and choose a file but not an other role. For the other role the "browse" button does not appear.

Have you got an idea to fix this problem?


texts:
OK, this ought to be easy but I've been trying all sorts of ways to get this to work. I'm getting this error in trying to insert a value from the $_SESSION array. I've hunted to determine how to figure out the right key for the field I want to insert this value but must be misreading Drupal's devel module. The form is generated from creating content in a custom content type so there's not a form I've manually set up. Some search results suggest I'm not using a callback in the hook_forms function but this is not used for a $form in a custom module, just the custom content type. The $form_id was derived from using dsm() for the form in question.

function re_dashboard_form_alter(&$form, &$form_state, &$form_id) {
  if ($form_id == 're_dashboard_research_project_node_form') {
    $form['field_resident_vunid'] = t($_SESSION['vunid']);
  }
  dsm($form);
}

I believe the $_SESSION key is right because I did a dsm() on it earlier. I would have thought that the $form['vunid'] would be correct but I still get this error. It's either a goof I'm not seeing in my Google searches or I have one of these keys wrong. What am I overlooking?, thx, sam


texts: I have an exposed filter in drupal, but some text is not displaying as expected. One list displays exactly as I want and that is the Acoustic Guitars as shown in the picture, but I cannot for the life of me figure out why the other filters are not displaying like the Acoustic Guitars. Here is the picture, does anyone know what settings I would need to change to get this to display the description instead of the category like the Acoustic Guitars list?


texts: Module to easily insert link to other content into textarea?

texts:
Title pretty much says it all. I want a button or something next to the textarea that will let you link selected text to a particular node.

I am guessing that I should be using the WYSIWYG module with a particular editor, and happy to hear suggestions as to which combination.


texts: How do I get the teaser/summary displayed as a field using Views3 and Drupal7?

texts:
I'm using Views 3 and Drupal 7.

How do I get the teaser/summary displayed as a field in a page view?

Thanks,
Greg


texts: Better way to manually load a view of nodes other than with "views_get_view_result" > "node_load"?

texts:
I've got a d7 site on a shameful shared hosting account.

Since I am a pseudo haxxor, I want to load up my front page view and manually output all of my nodes.  My Front Page takes about 30 seconds to load in the worst case.  I am tears.

Here is what I am doing:

$view = views_get_view_result('main_feed');
foreach($view as $item){
    $node = node_load($item->nid,NULL, TRUE);
    /* assorted display code */
}

Any thoughts?  2.7 trillion thanks to all!

EDIT:

Well @Druplaist was right - this SHOULD work - after reading my own question I thought "If somebody else were asking this, I'd suggest that the problem was inside of /* assorted display code */ - and it is - probably some truncating method I grabbed.  It's still Drupal slow, but not 30 seconds till the server gets back to me slow.

Thanks for answering my stupid question, people!


texts:
I would like to allow users to search node location using location city with synonyms.

For example:

New York
NY
NYC
New York City

etc.

should bring the same search results.

How to do this ?


texts: How to load current user cart in Commerce 2?

texts: In Commerce 2, how can I load the current user's cart? The current user may be either anonymous or logged in. The site has multiple stores and I won't know which store the user is currently on.


texts: How to add class to the options for type radio present under radios?

texts:
function template_preprocess_bef_radios(&$variables) {
  $variables['children'] = Element::children($variables['element']);
  _bef_preprocess_nested_elements($variables);
    foreach($variables['element'] as $tid => $value) {
        if (is_numeric($tid) || $tid === 'All') {
            $value['#attributes']['class'][] = Html::cleanCssIdentifier($value['#title']);
        }
    }
 }

While trying the above does not add class to radio button under radios(which has multiple options)
How can I add class to the options ?


texts: Get radio field value in data selector in rules

texts:
In content type form, I have a select list as radio with two values "Complaint" and "Feedback".

After content type save, I need to send email if "Complaint" is checked to complaint@web.com and if "Feedback" is checked then send email to feedback@web.com

I know how to do that with text field (e.g field-text-field is empty or not) but not yet found any solution with radio buttons.

Note: I have installed the Rules module, and also enabled its sub-modules Rules UI and Rules Scheduler.


texts:
I've defined an callback:

$form['process'] = [
  '#type' => 'button',
  '#value' => $this->t('Process'),
  '#ajax' => [
    'callback' => 'Drupal\custom_graph\Form\ExamplePageForm::exampleCallback',
    'wrapper' => 'example',
  ],
];

$form['example'] = [
  '#type' => 'container',
  '#attributes' => [
    'id' => 'example',
  ]
];

if ($form_state->hasValue('process')) {
  $form['example']['hello'] = [
    '#markup' => 'Hello',
  ];
}

The callback returns the example part of the form.

  public function exampleCallback(array &$form, FormStateInterface $form_state) {
    return $form['example'];
  }

However since I have a title field that is required as well:

$form['title'] = [
  '#type' => 'textfield',
  '#title' => $this->t('Title'),
  '#required' => TRUE,
];

The error message from that field is appended to the example container. I've tried add #limit_validation_errors() but when I do, the hello is not appended as expected (the form state seems empty)

What is the proper way to do this semi- callback that does stuff and builds up on the form?


texts: Views Bulk Operations Checkboxes check on click

texts:
I do search for a specific option in bulk operations. For now, when I click somewhere in my row, the checkbox for the bulk operation gets selected, but I want a user to directly click on the checkbox. If he clicks somewhere in the row, it shouldn't select the row for bulk-operations. Any chance to do that without hacking the core?

In short: only a direct click on the checkbox should select the row for bulk operations.


texts:
When writing a custom module, what is the proper way to insert a localized menu via hook_menu or hook_menu_alter? By localized I mean not only the translated label - that'd be done using the t() function on title - but also having localized path and page callback.

I tried something like this:

function hook_menu() {
  global $language;
  $items = array();

  switch($language->language){
  case 'en':
    $items[] = array(
      'title' => 'Contact Us',
      'page callback' => 'drupal_goto',
      'page arguments' => array('node/285'),
      'access callback' => TRUE,
      'menu_name' => 'main-menu',
      'type' => MENU_NORMAL_ITEM,
    );
    break;
  case 'pl':
    $items[] = array(
      'title' => 'Kontakt',
      'page callback' => 'drupal_goto',
      'page arguments' => array('node/286'),
      'access callback' => TRUE,
      'menu_name' => 'main-menu',
      'type' => MENU_NORMAL_ITEM,
    );
    break;
  }
  return $items;
}

but this is not behaving properly - once created, the menu item stick at the original language regardless of subsequent language negotiations. So what is the way to go?

Edit after trying out the code provided in answers
OK, so I approached that topic afresh and tried out all of the three methods suggested below. The two programmatic methods have the culprit that the array key used to install the menu item (as in: $items['corporate/contact-us']) will display in the status bar on hover, regardless of the language chosen. This is cosmetic but I consider it a bad UX. The third - UI-based - method has a side-effect (which is not the point of the original question) but was tried out just for curiosity. The point of my question was - whether it was possible to install a localized menu item totally programatically, and get exact result as when done through UI. Looks like this is not quite possible, unless there's a piece of know-how that I'm missing.


texts: How to make the Rules module perform a redirect to an URL that includes a query string?

texts:
I have created Task nodes, and I want to redirect to the previous (source) page after creation of a new task. I don't want people to see the task node. That page includes a view of all tasks.

For that I have created a simple rule:

Event: After saving new content
Condition: Content is of type tasks
Actions: Page redirect to [site:current-page:url]

This works, but not for a page that includes a query string. The rules redirect action chops off the query string of the source page.

In my case, I have a source page that always includes ?og_group_ref=[node:og-group-ref] in the URL in order to create group tasks. After creating a group tasks, the redirect happens but the query string in the URL is gone.

I tried to change the Rules redirect using Rules Action "Page redirect to [site:current-page:url]?og_group_ref=[node:og-group-ref]". However, that gives an error:

  Input evaluation generated an invalid URI.

Is there a way to accomplish Rules redirect including the query string?


texts: Can A View Load All Data, And Filter (Hide) With CSS?

texts:
When using an exposed filter in a view, any data that doesn't meet the filter is removed from the page. Partially for SEO reasons, I'd like all the data to load (and stay in the HTML), but then the exposed filters will simply use CSS to hide the data that doesn't match the filter.

Does that make sense? Is it possible?


texts: I have an 'Entity Reference' autocomplete field populated by a view that returns all authenticated user email addresses.  I have set the field to 'Required' but when I enter an email address not in the list and save the node, it doesn't trigger an error.  It just makes the field blank.  Is there anything I can do to force the node not to save if a valid email address has not been entered?


texts: How to redefine a message type for drupal_set_message?

texts: By default, there are 3 (status / warning and error). I will wish to add the info type, with a blue background for example. What to do?


texts: Custom field type validation in field type definition class

texts:
Scenario: I created custom field type and need to add my own custom constraint/validation prior to saving.

Problem: failed to add custom constraint plugin so I implemented the function in

public function preSave() {
$return = $this->custom_check($this->value, $this->getSetting('check_options'));
if(!$return[0]){
  drupal_set_message($return[1]->__toString(), 'error');
  $url = \Drupal::service('path.current')->getPath();
  $response = new RedirectResponse($url);
  $response->send();
  exit;
}
}

function custom_check($value, $check_options){
//checking goes here
}

I user drupal_set_message() and RedirectResponse as I couldn't get the $form or $formState of the node/%nid/edit to set the error at field and dor form rebuid.

I know that solution is not the best practice and I have to create my own constraints and validation but I spent time with no luck to work and I didn't found a working example that suits my case escpicially I need to validate based on field settings so I have to pass two parameters value and setting.

Please help getting the current form array and formstate in presave to rebuild instead of redirect. or show me how to write simple constraint that takes parameters and how to add it to my custom defined field type.

Thanks in advance.


texts: Do private properties persist between submissions on multi-step form?

texts:
I'm creating a 3-step (3-page) form in Drupal 8.  One property I use for all three pages is $continue - which triggers an exit process (redirect) if an error condition is encountered, or allows the process to continue through all three pages.  Also, there is a node created during submitForm() in step 1, and the node id is needed in steps 2 and 3.

I'm struggling with exactly how to pass data of that nature through the multiple steps.  Initially, the form is built, and properties can be initialized in the constructor.  But after the user submits the form, that's an entirely new request, right?  So doesn't the form class have to be instantiated again before the submitForm() method is invoked?  If so, it doesn't seem like properties could persist from buildForm() to submitForm() and back to the buildForm() for step 2?

In Drupal 7, I had to save all values I wanted to persist into $form_state.  Do I still need to do the same in Drupal 8?


texts: Overriding and extending a field to update a View using AJAX

texts:
I have a series of nodes that are rendered using a view.

In these individual nodes - as part of the display mode I have a field that links the node to a taxonomy. This is rendered as a label (linked to an entity reference) and can be overriden using the field field-taxonomy-term-link.html.twig

Note the view has an exposed filter that allows users to filter the view by the mentioned taxonomy above.

The question is:

How can I alter my field-taxonomy-term-link.html.twig template to update the view using AJAX when I click on my field link, instead of forcing a page referesh as i'm doing at the moment using a query parameter in the url / contextual filter / $_GET method.

As it stands my field-taxonomy-term-link.html.twig contains:

{#
/**
 * @file
 * Theme override for a field.
 *
 * To override output, copy the "field.html.twig" from the templates directory
 * to your theme's directory and customize it, just like customizing other
 * Drupal templates such as page.html.twig or node.html.twig.
 *
 * Instead of overriding the theming for all fields, you can also just override
 * theming for a subset of fields using
 * @link themeable Theme hook suggestions. @endlink For example,
 * here are some theme hook suggestions that can be used for a field_foo field
 * on an article node type:
 * - field--node--field-foo--article.html.twig
 * - field--node--field-foo.html.twig
 * - field--node--article.html.twig
 * - field--field-foo.html.twig
 * - field--text-with-summary.html.twig
 * - field.html.twig
 *
 * Available variables:
 * - attributes: HTML attributes for the containing element.
 * - label_hidden: Whether to show the field label or not.
 * - title_attributes: HTML attributes for the title.
 * - label: The label for the field.
 * - multiple: TRUE if a field can contain multiple items.
 * - items: List of all the field items. Each item contains:
 *   - attributes: List of HTML attributes for each item.
 *   - content: The field item's content.
 * - entity_type: The entity type to which the field belongs.
 * - field_name: The name of the field.
 * - field_type: The type of the field.
 * - label_display: The display settings for the label.
 *
 * @ingroup templates
 *
 * @see template_preprocess_field()
 */
#}

    {%
      set classes = [
        'field',
        'field--name-' ~ field_name|clean_class,
        'field--type-' ~ field_type|clean_class,
        'field--label-' ~ label_display,
      ]
    %}
    {%
      set title_classes = [
        'field--label',
        label_display == 'visually_hidden' ? 'sr-only',
      ]
    %}

    {% set taxonomy_term_link = '/my-view-url?link=123' %}

    {% if label_hidden %}
      {% if multiple %}

          {% for item in items %}

{{ item.content['#title'] }}

          {% endfor %}

      {% else %}
        {% for item in items %}

{{ item.content['#title'] }}

        {% endfor %}
      {% endif %}
    {% else %}

{{ label }}

        {% if multiple %}

        {% endif %}
        {% for item in items %}

{{ item.content['#title'] }}

        {% endfor %}
        {% if multiple %}

        {% endif %}

    {% endif %}

Can anyone offer a solution that integrates with the AJAX in the view.. do I have to use the Drupal 8 JS API to manipulate the view?


texts:
I was suggested so many times to migrate my old project from D6, so I finally decided to jump into this. And as it always happens with Drupal, things never work as expected at first attempt.
The old Drupal 6 site has 180 modules (I've switched off a vast majority of them), 100K users, about 3K nodes (within 4 content types), 170 taxonomy terms, more than 5K different node relationships, 34K comments, 7K path aliases, 6K user pictures, 5K files (most of them attached to nodes through file fields) and some other stuff.
The new Drupal 8 site was installed with composer create-project drupal-composer/drupal-project:8.x-dev <FOLDER> --stability dev --no-interaction. I also installed all the suggested migration modules and ran the migration process through Drush. The Drush launcher version is 0.6.0 and Drush is version 9.6.0.
drush migrate-import --all command didn't go well, because it found some missing modules, which are not ported to D8 yet, so my only choice was to use something like drush migrate-import upgrade_d6_taxonomy_term --feedback="100 items" for each migration.
Data was ported, but with some problems.
Files
Some files are not attached to nodes, as they should, especially node images.
Moreover, on /admin/content/files page many of them appear with strange strings, instead of names and are linked to empty files: https://new.site.com/sites/default/files/sliwrunepeswothobrucohaphigeluwruj. All these files are actually empty.
As I understood, all of them are node attached images, used as cover image, supposed to represent an article on taxonomy or views pages.
Body field
It is also ported but with two issues:
1) All HTML tags are converted to <p> tags. E.g. if there was H2 heading, it is <p> tag now. The same thing for <li>, images, youtube embedded videos... all inline tags are deleted completely with their contents or replaced by paragraphs. Class names were wiped as well.
Full HTML is enabled for body fileds on both sites.
2) Body is not showing up, when I view a node. If I go to edit - it is in right place, I can even cahnge it. But on node view <div>, which should be containing body, is empty.
I've googeled it, and some say that they changed site default language or edited body teaser, because it cannot be null... but all these things are fine in my case - site language is the same, as it was in D6 version and node teasers are not empty.
Paths
All 7243 path redirect entries are migrated without errors. I can see all of them on /admin/config/search/path page of new site. However, all node urls are default (node/1234) and if I click on url alias it redirects me back to node/whatever-number.
Also on migrated node, path field is empty.
Creation of a new node doesn't have any of described problems, everything works fine.


texts: How to create view of taxonomy terms and then once clicked on taxonomy term another view will be opened displaying all content having that term?

texts:
I have a taxonomy called "Destination Type". There are 4 terms in it (Historical, Leisure, Wildlife,Cultural).
I have created one content type called "Destination" with taxonomy field "destination_type".
Now I want to create a view of taxonomy "destination type" which is I am able to create. Once user click on any of the term in that view say Historical, then the next view should open displaying the list of all destinations with destination type as historical.

This is how I want the result same as "Jump right in, Things to do" in http://www.gotobermuda.com/

I am stuck here. Please help me out with this

Thank you


texts:
Looking at the documentation for hook_views_data(), I see this:

$data['example_table']['table']['base'] = array(
  'field' => 'nid', // This is the identifier field for the view.
  ...
);

What exactly does identifier field mean? Is it supposed to be the primary key of the table? If so, what if the primary key is composite? Or if not necessarily primary key, why wouldn't it be?


texts: How to render complete page when overriding page--node--add--typename.tpl.php

texts:
I'm trying to add more buttons to a custom content type form.
I create a page--node--add--typename.tpl.php where I modify the form then render it:

$form = node_add('answer');

$form['actions']['cancel'] = array(
    '#type'   => 'submit',
    '#value'  => t('Cancel'),
    '#access' => TRUE,
    '#weight' => 55,
    '#submit' => array('cancel_button_form_cancel', 'node_form_submit_build_node'),
    '#limit_validation_errors' => array(),
);

print drupal_render($form);

However this only renders the form. Menus and other blocks are not rendered.

THanks.


texts: Integrate external DB users via their API in Drupal 7

texts:
I want to integrate an external API (REST) to login users which are on that external database using the drupal 7 login form on my site.

I have the API specifications for Login, Registering, Getting member details and Check logged in. I also have a URL to test GET and POST requests on that external DB.

How do I integrate it with Drupal database so that users can log in using either Drupal's DB or external DB (integrated with the API)?

I have just discovered Services module but not sure if it is of any help.

I'm not an expert in creating custom modules either so any sample code or any pointers would really help here.

NOTE: External API requests return XML output


texts: Using Composer in a multisite installation

texts:
How do I manage modules via composer in a multisite architecture? For example, if I want one site to have version 2.3 of a module, and another to have version 2.4, how do I do this?

Do I have a composer file in each site that can inherit from the composer file in the parent Drupal application?


texts: How to translate plurals in language with multiple cases (most of European)

texts:
Function format_plural is useable only if language has only one plural case (English), but I need to use it for Czech language what has (like most languages from slovenian and roman family) more cases for plural.

For example English has two cases:

1: bed
2-∞: beds

But in Czech we needs more cases for the same word:

1: postel
2-4: postele
5-∞: postelí

And the schema is usually different for different words. (Mistake, it is the same for all words in one language, but different between languages.)

Is there some API in core or in some module that can translate this (for Americans crazy :-)) cases?


texts: How to replace url of taxonomy label link?

texts:
I want to alter url of a field and his display.
The field is a taxonomy label with link to the entity.
The default url is : taxonomy/term/{tid}

I wanto to chage with : my_specific_page?technologie={tid} (used to prepopulate exposed filter)

I tried with :

function MYTHEME_preprocess_field__field_technologie(&$variables, $hook){
  $element = $variables['element'];

  foreach ($variables['items'] as $item) {

    $route_name = 'entity.node.canonical';
    $params     = 39;

    $options = [
      'query' => ['technologie' => 27],
    ];
    $url = Url::fromRoute($route_name, array('node' => $params), $options);

    $item['content']['#url'] = $url;
  }
}

I think i need to replace routeName attribut, but how ?

Content type : "manage field"

Content type : "manage display"

Kint result $variables['element']
[]3


texts:
I'm confused by the field_collection API. I created a Field Collection and attached it to a node (in the GUI) but I can't figure out how to code an update/addition to the field collection. This is my scenario:

I have a node (request) that has product information and quantities. When users go to a product page they see a link to "Add to Request". This link should add the product (nid) to the node request. The difficulty lies in the fact that I need quantity information as well, hence the Field Collection. I added a quantities field and grouped it with the product field.

Node Type: request
Request ID: $requestid
Product ID: $productid
Field Collection = field_request_collection (Unlimited values)
Field Collection Field = field_products (Entity Reference, Max 1)
Field Collection Field = field_product_quantities (Integer, Max 1, Default 1)

My function looks like this (the values for $requestid and $productid are passed in the URL of the link: /my_request/5/12):

function _my_module_request_update($requestid,$productid) {
$nload = node_load($requestid);
$field_collection_item_value = $nload->field_request_collection[LANGUAGE_NONE][0]['value'];
$field_collection_item = entity_load('field_collection_item', array($field_collection_item_value));
$field_collection_item->field_products[LANGUAGE_NONE][0]['value'] = intval($productid);
$field_collection_item->save();
}

The error I'm getting with the above code is:

  PHP Fatal error:  Call to a member function save() on a non-object

Keep in mind that I'm attempting to ADD Field Collection values NOT replace them.  Please help, thanks!


texts: Can you restrict core search to the current language?

texts:
I can't figure out how to restrict results to current language other than crude theme preprocess hacks to inspect the language of individual results. I haven't had luck getting contrib search modules that might allow filtering to work.

Can I override the results page with a view and filter there?


texts: Custom validation with conditional fields

texts:
I have a content_type campusactiviteit which has a lot of conditional fields.

When the user hits "catering" three fields appear: "kostenplaats", "bestelbonnummer" and "soort_catering".

When the user hits "soort_catering", three other conditional fields appear.

But, "kostenplaats" OR "bestelbonnummer" are required. Herefore I wrote a custom validation. This works, but the conditional fields of "soort_catering" don't work anymore.

This is my custom validation:

function kostenplaats_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'campusactiviteit_node_form':
      $form['#validate'][] = 'custom_data_validate';
      break;
    }
}

function custom_data_validate(&$form, &$form_state) {
  $values = $form_state['values'];

  if(!empty($values['field_catering'][und][0]['value'])){
    if (empty($values['field_op_welke_kostenplaats_mag_'][und][0]['value']) && empty($values['field_bestelbonnummer_ku_leuven'][und][0]['value'])) {
        form_set_error('field_op_welke_kostenplaats_mag_');
        form_set_error('field_bestelbonnummer_ku_leuven');
        drupal_set_message(t('U moet ofwel een bestelbonnummer of de kostenplaats invullen!'));
      }
  }
}

Is there a solution for this or another way to solve this?


texts: hook_form_FORM_ID_alter being called twice (even before submit)

texts:
I want to make some changes to the "Content" page.
The ID of the form is views_form_content_page_1, so I made a quick test (after drush cr of course):

function my_module_form_views_form_content_page_1_alter(&$form, FormStateInterface $form_state) {
  kint($form);
}

When I go to the page, the $form is being printed twice by the devel. I checked, all of the array items are the same. If I do kint('cat');, then it will print cat two times.

Why is this happening? Of course I could make it work, that my action will run only once (eventho drupal tries to run it twice) but I would like to rather solve this one, and understand if it's a bug, and why it is happening.


texts:
I created a block, in which an img with src="sites/mysite/files/imagename". It works every node, but failed loading in search page.

Is this an issue of Search module?
Drupal 7, I hope, has a uniform url management, for example:

exapmle.com/files, exapmle.com/modules/Module_name, or
exapmle.com/modules/core(Symbolic Link points to sites/all/modules) /Module_name
exapmle.com/themes/Theme_name, or
exapmle.com/themes/core(Symbolic Link points to sites/all/themes) /Theme_name ...
...


texts:
How can I move the following markup after the one loading jQuery and drupalsettings?

<script src="https://abc.ai/js/w?key=abc.jdnwVFfn4YUZA0in"></script>

Actually, the order is the one in the following markup.

<script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","scriptPath":null,"pathPrefix":"","currentPath":"node","currentPathIsAdmin":false,"isFront":true,"currentLanguage":"en"},"pluralDelimiter":"\u0003","ajaxTrustedUrl":{"\/search\/node":true},"user":{"uid":0,"permissionsHash":"a791675a6fdb4f639fabce88c7e91295566b58e25f936b9d181582d9321c503f"}}</script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=3.2.1"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.5.1"></script>
<script src="/modules/abc/js/abc.js?v=1.x"></script>

I used hook_page_bottom() to attach the script in the abc module.

function acobot_page_bottom(array &$attachments) {
  $attachments['#attached']['library'][] = 'acobot/acobot-initialise';
  $attachments['acobot'][] = [
    [
      '#type' => 'html_tag',
      '#tag' => 'script',
      '#attributes' => array('src' => 'https://acobot.ai/js/w?key=' . $token),
    ],
    'acobot-token',
  ];
}

The content of the abc.libraries.yml file is the following.

abc-initialise:
  version: 1.x
  js:
    js/abc.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

I added weight in the below code(instead of #attached in hook_page_bottom) but it does not change the position .

function acobot_library_info_alter(&$libraries, $extension) {
$libraries['acobot'] = array(
  'version' =>'1.x',
  'js' => array(
     'acobot/acobot.js' => array(
        '#weight' => 100,
     ),
   'dependencies' => array(
     0 => 'core/jquery',
     1 => 'core/drupalSettings'
   )
  ),
);

  return $libraries;
}


texts:
I've enabled Clean URLs which has tidied my URLs up a bit, however I need them completely rewritten for SEO purposes. For instance my 'blog' content type should be '/blog/blog-entry/' rather than 'node/etc'.

I've looked around but I can't find a stable solution for 7.7 ?
Either a module or hook function in my theme would be fine

Thanks in advance


texts: How to modify the link titles shown in /node/add page?

texts:
I can modify the menu item title implementing the hook_menu_links_discovered_alter() hook, as illustrated in this screenprint:

I changed the menu item title to "Article (Only One Article can be created and edited)".

But the problem is that the same item is shown also in the /node/add page but the title of that link is not changed because it is shown by a controller. As illustrated in the above image also, the menu links are changed but the link in the /node/add page remains without changes, which is still just "Article".

How I can change that value also, i.e from "Article" to "Article (Only One Article can be created and edited)", so that it matches with the menu item title?


texts: Drupal 7, Looking for a module that can geo-locate a user and feed them specific data?

texts:
I'm trying to build a site where I can geo-locate anonymous users when they visit the site and feed them the appropriate data.

Example: I want to display a certain block if the anonymous user's IP is located within 100 miles radius of NYC.

Is there a module that can plug into Rules as a condition and geo-locate anonymous uses?


texts: What is the correct way to cache blocks by language?

texts:
I have a multilingual site with custom blocks in the right-hand menu - the content of which is generated dynamically through the build() function of BlockBase and which changes depending on the interface language. I want to cache these once per language. Elsewhere I've used:

public function build() {
 $node = \Drupal::routeMatch()->getParameter('node');
 return array(
  '#theme' => 'my_template',
   ....
  '#cache' => [
    'tags' => [
      'node:' . $node->getId()
    ],
  ],
);

}

I've gone with this approach, which appears to work, although I'm not sure how to test that it isn't still processing templates on every call:

public function build() {
 return array(
  '#theme' => 'my_template',
   ....
  '#cache' => [
    'tags' => [
      'language:' . \Drupal::languageManager()->getCurrentLanguage()->getId()
    ],
  ],
);

}

Is this the correct way to do it? I could find examples of the node: prefix in the docs, but nothing about language:


texts: I'm writing a visibility rule for an element on a Panel page that also has a view with exposed filter. The goal is to show this element only when the filter isn't set. Is there a way to check weather the view on the current page was filtered with exposed filter or not?


texts: How to implement global messaging system in drupal for multiple sites?

texts:
I have more than 100 sites that need to be maintained. So I am looking for way to put up a notice message for this group of sites. For example: We are having maintenance scheduled for tomorrow 10 PM. The message will be persisting for a time being for all the sites.

Here I am assuming that there should be a central node from where we can push a message to all sites at once and delete when required.

So, I am looking for some help if there is already existing set of tools or way I can implement the workflow.

  I have tried Drupal Remote Dashboard module, the module seems to
  offer site monitoring from master node (site), but it doesn't seem to
  offer the global messaging option.


texts: How to disable adsense for this error page

texts:
I want to disable adsense ads for this url: http://www.indiacustomercare.com/node/167/submission/274

which is accessible only to the admin.

How can I do it for my D6 site?


texts: How do I write a hook to compile css and js with drush make?

texts:
We are using drush make in our deployment of new and updated platforms through Aegir and thus drush provision.
We do not keep our theme css and js under version control as it complicates any conflict resolution between coffee and scss source files.
I want to automate the compiling of the css and js directories as part of the Create new platform provisioning script run by Aegir but cannot think of the right way to do this.
Main issues:

The granularity of a drush-hook-post-make is too course; not every download needs to be processed: e.g. only one theme needs to run a compile script after having been cloned from our git repo by drush make. How would we distinguish which downloads needed post-make processing?

git pre-commit and post-checkout hooks are under vc in the theme's repo and would do the compiles but need to be explicitly invoked.  Currently we manually symlink to the vc'd git hooks and run the compiles ... would like to automate this step.


texts:
I am struggling in the integration of CKFinder to CKEditor in a development drupal 8 installation.

Where to place the folder and how to tell the Editor to use CKFinder


texts: 'Manage display': new fields not draggable

texts:
When I try to drag'n'drop a field under 'Manage display' / inside a view mode (e.g. "Teaser") it just doesn't stay above the Hidden fold. First the confirmation message is shown. But as soon as that fades out, the field 'jumps' back to the Hidden section. And instead of the field I just dropped above the Hidden fold, the field list only shows "No field is displayed".

It did of course work before. Since then I have installed the module "update jquery" – but I suppose that's not the problem since all other drag'n'drop UIs seem to work perfectly fine.

Also I had the module "Entity view modes" installed – but I disabled it because I first thought that that might have caused the problem. Now it's off – but the bug is still there.

Caches are of course flushed, and no errors in firebug's console.

Anybody any ideas what could be wrong? Any pointers? Thank you!

Update: When setting the format manually from 'Hidden' to 'Default' (or any other state) everything seems to be ok: the field jumps right up above the Hidden fold. Also fields that once were 'active' I can still drag'n'drop into active and inactive state. Only new fields seem to be not draggabe. Strange – but for now I think I can live with that. But still: if anybody has any suggerstion I would gladly appreciate it.


texts: Change the filter widget type in a views

texts:
When adding a reference field as a filter in a views the default widget of the filter is drop down.
Is there a way to change it to a auto complete widget?


texts: How to add custom dynamic class to the view row in field handler?

texts: I'm implementing custom Views field handler and need to add entity_id-based class to the row. When the field is enabled in view it should add class to the whole row.


texts: How can I implement user timezone & user's last login in this format?

texts:
Im trying to create a block and I'm  having trouble. I'm trying to get the user's last login & the user's timezone. How can I implement those functions in these hooks. All I know is the fact that I need to use the functions of hook_info & hook_view.

function hook_block_info() {

  $blocks[‘syndicate’] = array(
    ‘info’ => t(‘Syndicate’),
    ‘cache’ => DRUPAL_NO_CACHE,
  );

  $blocks[‘recent’] = array(
    ‘info’ => t(‘Recent content’),
  );

  return $blocks;
}

function hook_block_view_alter(&$data, $block) {

  if (is_array($data[‘content’]) && asset($data[‘content’][‘#contextual_links’])) {
    unset($data[‘content’][‘#contextual_links’]);
  }

  if (is_array($data[‘content’]) && $block->module == ‘some module’) {
    $data[‘contentr’][‘#theme_wrappers’][] = ‘mymodule_special_block’;
  }
}


texts: I have a View with an path like example.com/en/news. I translated the view with Views translation. Works like a charm. But how and where do I translate the path to something like example.com/de/neues?


texts: How to find the cause of 'The following module has moved within the system'?

texts:
I can't get rid of this message whenever I install a module, it shows:

  User warning: The following module has moved within the file system: [modulename]. In order to fix this, clear caches or put the module back in its original location. For more information, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1138 of /data/all/000/core/drupal-7.54.2/includes/bootstrap.inc).

I read the documentation mentioned, but cannot find a module that could cause this.

What would be the right way to find the cause?


texts: Is there a way to take a configured entity reference field and attach it as-is in a custom module?

texts:
I have an entity reference field that I've configured and have added to a content type. Is there a way to take that same field and attach it with it's configuration in a custom module? I can attach the entity reference field using "Entity reference autocomplete" but the problem is that I have it configured to use View Mode with an argument to filter the list. When I attach it using "Entity Reference Autocomplete", it's without the View Mode and argument. I need to be able to carry those forward. I have it attached like this:

  $form['my_entity_reference'] = array(
    '#type' => 'entityreference',
    '#title' => t('My Reference'),
    '#era_entity_type' => 'user',  // Mandatory.
    '#era_bundles' => array(), // Optional (Any bundle by default).
    '#era_cardinality' => 3,       // Optional (1 By default).
  );

Thank you.


texts: How do I fetch user profile data in search api entity (node) view?

texts:
I've one search api index view of node type. Then each user have profile. So I wanted to fetch profile data of that entity created user. In normal view it can be easily done with relationship. But in search api view not able to create relationship. Any idea?

Same way I wanted flag relationship also but it's not happening in search API view. Normal view it's fine.


texts:
Perhaps the question is simple, but I can not understand how to return the body of a node without a menu.
I did a module that loads the content of node into the custom area.

function loadnode_in_region_menu_alter(&$items) {
    $items['load_node/%'] = array(
        'page callback' => 'loadnode_in_region_node_page_view',
        'page arguments' => array(1),
        'access callback' => 'user_access',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

return $items;
}

function loadnode_in_region_node_page_view($nid) {
    $node = node_load($nid, NULL, false);
    $vnode = node_view($node);
    return drupal_render($vnode);
}

JS looks like

    jQuery.ajax({
        type: 'GET',
        url: Drupal.settings.basePath + 'load_node/' + id,
        dataType: 'html',
        success: function(data){
            jQuery('#ajax-result').html(data);
        },
    });

Result looks like this, with a duplicate menu

If I change line from

    return drupal_render($vnode);

to

    echo drupal_render($vnode); OR print drupal_render($vnode);

The result looks like I would like it, but some fields are not displayed correctly, such as voting and image. Looks as if they are not themed.

How to return themed node body without a menu?


texts: How to implement admin verification for selected user profile fields?

texts:
After the user fills the registration form, if the profile is appropriate, the administrator user approves it, and the profile goes live; if it is not appropriate, the administrator user will reject it, but the user still has the chance to proceed with changing the picture and content until it is appropriate. The administrator user will then review for the second time to be sure everything is fine, and the profile will go live.

How can I achieve this?


texts:
i'm working with groups and users, and i would like to display only the users that are not already in a group to prevent errors while writing the name of the user.

Here is the menu :

$items['mod/%group/membership/autocomplete/%/%'] = array(
    'page callback' => 'my_autocomplete',
    'page arguments' => array(1, 4, 5),
    'access callback' => 'group_access',
    'access arguments' => array('administer group', 1),
    'file' => 'my_file.inc',
    'type' => MENU_CALLBACK,
  );

Here is the form :

$autocomplete_path = 'mod/' . $group->gid . '/membership/autocomplete/' . $someData;
$form['content']['user'] = array(
        '#type' => 'textfield',
        '#autocomplete_path' => $autocomplete_path,
        '#required' => TRUE,
        '#element_validate' => array('my_validation'),
      );

And for the autocomplete function :

function my_autocomplete(Group $group, $is_member, $string = '') {
  $matches = array();
  if($string) {
    //do things
  }
  drupal_json_output($matches);
}

And it doesn't display anything on my form. However, if i don't check the $string, i will have all the data i want but it will not be display in function of what i'm writing which makes it pretty useless.
I know there is nothing in the $string but i don't see how i will be able to populate it.

Thanks for your help :)


texts: I'm using a stock version of Drupal 8.1 and trying to figure out how to setup the quick edit inline module. I just want to be able to edit the fields on the fly without having to go to the edit page. I looked all over and I can't seem to find any setting to turn on the quick edit module for a specific field. What else could I be missing? The module is indeed turned on.


texts:
I have created a ViewsSort plugin that works on a normal view (like taxonomy_term) but not on a view based on Search API : it is not present when I click on "Add sort" in BO.
This sort is used to create a custom order of content types, and I use hook_views_data_alter() to provide it to views :

/**
 * Implements hook_views_data_alter().
 */
function mymodule_views_data_alter(array &$data) {

  // works on classic view
  $data['node_field_data']['inspiration_first'] = array(
    'title' => t('Custom search sort in page tags with inspiration first'),
    'group' => t('Search'),
    'help' => t('Sort content types in this order : dossier_inspiration, dossier_conseil, produit.'),
    'sort' => array(
      'field' => 'type',
      'id' => 'inspiration_first',
    ),
  );

  // doesn't work on search api view
  $data['search_api_db_default_search_content_index_content_type']['inspiration_first'] = array(
    'title' => t('Place inspiration first for custom search'),
    'group' => t('Search'),
    'help' => t('Sort content types in this order : dossier_inspiration, dossier_conseil, produit.'),
    'sort' => array(
      'field' => 'value',
      'id' => 'inspiration_first',
    ),
  );

}

Any idea ? Some sorts like Random work also on search api and I've provided the good table, I think (search_api_db_default_search_content_index_content_type).


texts: In dutch, postal codes are formed by four numbers and two letters, e.g., 1274EA. I want to split this info to a field that contains '1274' and another field that contains 'EA' in this case. Can I do this by creating two hidden user fields, or should I create a new entity type with a user reference field and the two fields? I prefer the first option, if possible. CSS is no option.


texts: How to render related nodes by vocabulary X on vocabulary Y terms?

texts:
I did many research about related nodes by term. These solutions are good with related nodes by term on node pages but does not work on term pages.

Solutions I found: Add "Content: Has taxonomy term ID" in Views - Contextual filters.

Related nodes by taxonomy term in a view block
How do I show related content?
Views Related Content module

My idea:

Content type A node with term reference X
Vocabulary Y terms with term reference X
render content type A node with related term reference X on Vocabulary Y terms


texts: How do I incorporate an if-statement within my array to hide/display a link?

texts:
Using the coding snippet below, how would I write the code to display the "Change" link only when the value in status is "A"?

I think i'm making this harder than it has to be, but the use of both drupal module structure and php are throwing me, since i am just learning module development.

The link showing in the array below appears at the end of each of my rows. I only want it to appear when the status equals "A".

Because this link is within this array, i can't figure out how and where to implement it. I just want an [if statement] like this:

if (drupal_render($form['status'][$key]['status']) == 'A',)
echo l(t('Change'), 'rooms/avail_room/' . $key . '/' . arg(1), array('attributes' => array('class' => 'room-stat-avail'))),
else{
echo "";
}

so when the html table is displayed, the 'Change' link will only appear in the last column when the value of status is "A"

Can't believe I got the module working, but can't turn this link on/off as i want. See code snippet below:

function team_room_available_form($form) {
    $output = "No space available.";

  if ($form['roomid']) {
    foreach (element_children($form['roomid']) as $key) {
      $rows[] = array(
        'data' => array(
          drupal_render($form[''][$key]),
          drupal_render($form['room_title'][$key]),
          drupal_render($form['username'][$key]),
          drupal_render($form['status'][$key]['status']),
          l(t('Change'), 'rooms/avail_room/' . $key . '/' . arg(1), array('attributes' => array('class' => 'room-stat-avail'))),
        ),
        'class' => $form['status'][$key]['#value'],
      );
    }


texts: "Login to your account" form block not showing on frontpage when "View published content" is disabled for anonymous

texts:
I am new to Drupal 8 but not to Drupal ;

In Drupal 8, I enabled the "Login to your account" block in one of my regions :

But on the homepage, the block is not showing in the correct region, instead the login form appears in the "Main content" block (but on 404 pages, for instance, it works fine).

Please note that as it is a private website, I disabled the "View published content" for anonymous users, may it be related ? Maybe it triggers the login form in the main content block, thus deactivating the one in the other region ?

How to set up the login form block in the correct region, on my homepage ? Do I have to render the form in a template hook and then pass it to html.twig ou region.twig ?

Thanks in advance for your answers

For the comment reply :

There is nothing fancy with the theme, this is the generic page template, and the theme is quite empty, derivated from the Stable theme, in which I didn't find any noisy tampering. My gues is that the Core is rendering the form, thus hiding the block.


texts:
I have added product categories vocabulary to my default product type. Added few products through that default product type and selected relevant terms for each product I added.

When I am going to term page it is not displaying the products associated with that term.

Are there any additional steps required for that?


texts: I created a new views page which lists specific content types(products). And i have specific node node--products.tpl template file which is being used in views. I want to be able to use specific node template for views. How do i do that?


texts: Custom page containing list of nodes separated by content type and date like an Archive

texts:
How can I create a custom page containing list of nodes separated by content type and date like an Archive?

I think it requires pagination too. So is there any module for this purpose (Drupal 6)?


texts: Why some features are overriden after installation

texts:
This is my hook_install:

function moocollar_web_install() {

  // enable features
  $global_features = array ('display_modes_feature' , 'field_bases_feature' , 'image_styles_feature' , 'roles_permissions_feature' , 'sitewide_feature'  , 'wysiwyg_feature' , 'menus_feature');
  $functionality_features = array ('blog_feature');

  $enable_dependencies = TRUE;
  module_enable($global_features, $enable_dependencies);
  module_enable($functionality_features, $enable_dependencies);

  // create editor user
  $role = user_role_load_by_name ('editor');
  $new_user = new stdClass();
  $new_user->name = 'editor';
  $new_user->pass = user_password(8); // random password.
  $new_user->mail = 'editor@example.com';
  if ($role) {
    $new_user->roles = array ($role->rid => $role->name);
  }
  $new_user->status = 1;
  $new_user->is_new = TRUE;
  user_save($new_user);

  variable_set('features_default_export_path', 'profiles/moocollar_web/modules/features');
}

After install the blog_feature is overriden:

drush features-diff blog_feature
Legend:
Code:       drush features-revert will remove the overrides.
Overrides:  drush features-update will update the exported feature with the displayed overrides

Component type: info
  features[field_instance][] = node-blog_post-body
  features[field_instance][] = node-blog_post-field_image
< features[menu_links][] = menu-editor-menu_aadir-post:node/add/blog-post
  features[node][] = blog_post
  features[user_permission][] = create blog_post content

Component type: menu_links
< array(
<   'menu-editor-menu_aadir-post:node/add/blog-post' => array(
<     'customized' => 1,
<     'link_path' => 'node/add/blog-post',
<     'link_title' => 'Añadir post',
<     'menu_name' => 'menu-editor-menu',
<     'module' => 'menu',
<     'options' => array(
<       'identifier' => 'menu-editor-menu_aadir-post:node/add/blog-post',
<     ),
<     'router_path' => 'node/add/blog-post',
<   ),
< )
---
> array()

But if I execute revert features via drush, the features is on default state:

drush features-revert blog_feature
Do you really want to revert blog_feature.menu_links? (y/n): y
Reverted blog_feature.menu_links.                                                                       [ok]
vagrant@precise32 (linkinicio *) httpdocs$ drush fd blog_feature
Feature is in its default state. No diff needed.

On the blog_feature.info I've the dependency and the item:

...
dependencies[] = menu
dependencies[] = menus_feature
....
features[menu_links][] = menu-editor-menu_aadir-post:node/add/blog-post
....

Thanks you all for your time.


texts: Private website with Rules - Inherit custom fields

texts:
I want to create a website where all the content is only visible to logged in users.

(I don't want to solve it by using other access modules or by configuring the permissions of the roles, for specific other reasons.)

What I basically try to do with Rules is the following:

Given the value of "custom field X" (boolean) of "content type A" is true,
When a user  views a node of "content type B"
Then I want to redirect the user to [site:login-url]

But it seems that there is not a straightforward way to do this. Couple of methods that could be possible are:

Using entity reference: inheriting the value and firing the condition on the node view
Views looping: creating a view and firing the condition on all node views
Checking the value somehow when Drupal is initializing

I could do this also within a template tpl preprocess, by simply adding the logic. But it feels not right to solve it that way. Possibly because then there are other security issues that I'm afraid of neglecting.

Is there a better / easier way to do this? What would you recommend?


texts: Taxonomy as exposed Filter -> showing extra Field

texts:
I have a taxonomy with german umlauts in terms. This taxonomy I use as exposed filter in a view (with better exposed filters). To work with views arguments I named the terms WITHOUT umlauts (Oesterreich for Österreich). And I have an extra field where I have the names WITH umlauts.

Now I want to get the values of these fields shown in exposed filters to have the correct spelling.

Does anyone know how I can get this done?


texts: How do I access the database from a stand-alone PHP script?

texts:
I have problems to define the right path to the root and bootstrap data in php.

My structure (Windows) looks like the following.

C:\xmapp\

htdocs\

testdrupal\

test.php

includes\

bootstrap.inc

sites\

default\

settings.php

The content of the test.php file is the following.

<?php

  chdir('C:\xampp\htdocs\testdrupal\');
  // Bootstrap Drupal up through the database phase.
  include_once('./includes/bootstrap.inc');
  drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
?>

When I run it, I get the following error.

  Parse error: syntax error, unexpected '/' in C:\xampp\htdocs\testdrupal\test.php

What am I doing wrong?


texts: Add custom image watermark based on role and content type

texts:
I am adding small watermark logo to all images using ImageCache Actions

There are 10 users that are publishers of their own galleries, and i want to protect their images (i know they can not be protected 100%, but its something at least, and it looks nice).
When creating profile, those users must choose main image (logo) which would be used as watermark.

All galleries for all users have same formating (same image style), lets say:
Scale and crop, 300x250, watermark 40x40 - center, alpha 50%.

Watermark for now is website logo, but since all users are publishers of their own content, it would be nice feature to automamticly use their own logo as watermark to the content they are author of.

I can not find logic in how to do this with available modules, but seems to me it could be implemented easy, since all parameters in image style remains the same except the watermark image for author of the node.

Anyone has a suggestion how to do this? Maybe using rules?


texts: create and save data to a file in the files folder from cron

texts:
I currently have some working example code where when a URL path i defined using hook_menu has been passed; My custom module will use file_get_path() to pull a txt file from another ftp server. It will then return $data. The source data is stored that each line is a record. So I simply read the file one line at a time and use the explode() method to break the data into its components. From that I have it building a string in the format of a JSON at this point I return it to the user as a consumable JSON. This is used for my front end JavaScript. The problem is this data in the txt file changes very little over time. (its updated every night but very little changes).

I would like to reduce my request time by moving the fetch of the txt file to a cron job and build the JSON and save it in a sub directory of the Files directory. That way every request for the JSON data will be quick and not require a file_get_contents() and will also not require building the JSON data on every request.

I have been looking into the Files API and the hook_cron but very few quality examples show how to create a file or run a cron. I just need a simple example where a cron hook saves a simple file to a directory inside the files folder.

I'm using Drupal 7

UPDATE:

I tried the following: (objective to make sites/mysite.com/files/myDir/test.txt)

//File Name: MyModule_cron.inc
function MyModule_cron(){
    $baseDir = 'public://myDir';
    $fileContent = "hello world";
    file_prepare_directory($baseDir);
    file_put_contents($baseDir.'/test.txt', $fileContent);
}

This is loaded in from an inc file (added into the info file) and I have cleared my cashe then run cron. I then check in the sites files folder. The myDir is not created along with the file not being made. Is there something i'm missing? I'm not getting any error messages when running cron.


texts: How can I downgrade the jQuery library on Drupal 7 from 1.5.2 to 1.4.2; it looks like i've lost some functionality in Panels and Views after enabling the jQuery Update module.


texts: How to force a menu parent link to be non-clickable?

texts:
I want the parent link in the menu to not be clickable. As a path is mandatory, I have created a blank node, and in my module I substitute the link by a "#" char.

I used custom code in module because I have a multidomain/multilanguage site, and a mixture of Drupal and database own tables content for the links. Many solutions for custom menus could not be used as they were not compatible with Domain Access or there was some problem in customizing.

The code I use is:

$a = menu_tree_output( menu_tree_page_data("main-menu") );
if(in_array($value["#href"], array("node/123", "node/456"))) $nolink = true;

I wonder if there is a workaround to this problem, as the typical behavior for a parent menu is to be non-clickable, not to load another page, which would be, IMHO, less typical.


texts: Configure Videojs to use the local library

texts:
Videojs in Drupal 8 gives the following error:

  Missing the Video.js library. Please download Video.js and extract it into the //vjs.zencdn.net/5.0 directory.

How can I configure Videojs to use local files? Where should I put Videojs files?

I think Videojs has not configuration interface.


texts: How do I render a field collection on a node twice with two different field formatters?

texts:
With Display Suite, I want to render a field collection twice (or more) with different field formatters?

What's the best way for this?
- dynamic field (need more code for only duplicate a field...)
- token field?


texts: Picture Module, Amazon S3, CloudFront CDN setup?

texts:
Has any of you successfully set up the Picture Module for responsive images to work with Amazon S3 and CloudFront CDN?

I have been successful setting Drupal up to work with Amazon S3 and CloudFront, but the moment I enable the Picture module, things stop working.

All images that were uploaded previous to activating the Picture Module are coming from CloudFront, but new images that I upload are being pulled from the default Drupal file system.

I have configured the image fields to upload to upload to Amazon S3.

Any help is greatly appreciated. Thanks!


texts: url of custom theme not showing up with page.tpl

texts:
I've a custom theme. page.tpl has the html markup for my template. And I created some paths like 'about-us', 'terms' via my custom module.

Now, my problem is when I access the above defined paths. They are just showing up the contents defined in the callback function.

What I've to do if I want to show the contents in the content region of my page.tpl

Please help me.

----- THIS IS FIXED NOW :: THANKS FOR YOUR HELP -------


texts:
I have this template file for a view:

views-view--ir-news--page.tpl.php

But right now, I need to use Google AMP only for this view (Machine name: ir_news)
What I want to know is if something like this it's possible:

html-views-view--ir-news.tpl.php

Because I need to change, for this view the html tag from this  to this  only for this view.

Is this possible? Is that the way?
Thanks for the answers.


texts: What is the correct token for a multi value field?

texts:
Oke, so I have this multi value field in drupal 7 and I want to use it's values in a custom php snippet in the rules module.

I found the Array Tokens module to generate an array of the values, but that is for Drupal 6.

Then I found Architecture RFC: Field token architecture, which makes me assume I could use [node:field-name:0] or [node:field-name:value:0] to read the first entry, but I either replaces nothing of throws an error (I have tried various combinations).

Could someone tell me:

What is the right way to read a token with it's delta value?
How to get the delta of the fields so I can start a for loop?


texts: How to create a commenting system for ECK entities, similar to node comments as exposed field under the body?

texts:
I have done quite some research to accomplish comments under ECK entities, but all the tried solutions and modules appeared to hamper or be incompatible.

The idea is to create an exposed field for directly entering comments. It should allow for multi-level commenting (replies to comments).

I will update this question with the tried solutions.
If you have actually tried or implemented a commenting solution for ECK entities yourself, please post your answer.

If you have suggestions but have not tested it yourself, please post it as a comment to this question, and I will try your suggestion.

Option: module Comments Entity.
I can't get beyond a bug I posted in the issue about "Cannot save comments".


texts: How to navigate in a view result from node full view

texts:
I have a view which displays a list of nodes. When I click a node link from the view to see node's full view, I want in this node full view to add "back to list", "previous" and "next" links to let user navigate in view results.

I think to add view name and exposed filters selected values as parameters to node links in  the view, so I can compute navigation links in node full view. First question : isn't it an easier, cleaner, or more drupal compliant way to achieve this ?

If not : is there a better way to modify the links that in node teaser tlp.php ? I guess I could use hook_node_view_alter (I'm D7), but wouldn't it cause potential performance issue (I mean it need to test if I'm in my particular view for every node everywhere in the site, though it's a very specific feature)

Thanks for your help,

Philip


texts:
I'm not the best in php manipulation that's why I'm asking.

function supersized_libraries_info() {
  $libraries['supersized'] = array(
    'title' => 'Supersized',
    'website' => 'http://www.buildinternet.com/project/supersized/',
    'download url' => 'https://github.com/f3ndot/supersized/tree/3718ae83f0945e327cc09530b959c5a8b049871f',
    'version arguments' => array(
      'file' => 'slideshow/js/supersized.3.2.8.min.js',
      'pattern' => '/Version : (\d+)/',
      'lines' => 4,
    ),
    'files' => array(
      'js' => array(
        'slideshow/js/jquery.easing.min.js',
        'slideshow/js/supersized.3.2.8.min.js',
        'slideshow/theme/supersized.shutter.min.js',
      ),
      'css' => array(
        'slideshow/theme/supersized.shutter.css',
        'slideshow/css/supersized.css',
      ),
    ),
  );
  return $libraries;
}

That's the all code of supersized_libraries_info() function. I wan't to hook that using hook system so for my theme it suppost to be
mytheme_supersized_libraries_info() right?

Then I wan't to just edit css location so that supersized.shutter.css will be in placed in my theme location.

(My code!)

function koko_supersized_libraries_info($variables) {
  $libraries['supersized'] = array(
    'files' => array(
        'css' => array(
        path_to_theme() + '/css/supersized.shutter.css',
        'slideshow/css/supersized.css',
      ),
    ),
  );

I just want to edit the css property of that object. I don't know how to get to there.
Mine edit just doesn't work at all (nothing happends).

I want to clear css array and then set mine values.


texts: What would be on your checklist when trying to debug a non-reverting feature?

texts:
I've lost far, far too many weeks and weekends fighting with Drupal and the Features module in the last year, and I still can't find consistently reliable approach to debugging failed feature reverts.

Now I'm sure I can't be the only person having this problem, because I've watched enough other developers on projects I work on tearing their hair out too, so I'm asking this question, in the hope of saving pain in future.

What steps should you take when troubleshooting a non-reverting feature with Drupal 6?

It's safe to assume knowledge of drush, to run diffs of features, and watchdog, and the --debug and --verbose when answering.


texts: How many child pages can be added under a book parent item?

texts: When using the Book module, is there any limit on the number of child items that can be added to a book parent node?


texts: how to enable xml plugin in wysiwyg ckeditor 3.6.6.2

texts: I'm using ckeditor_3.6.6.2 plugin as text editor. In the ckeditor folder i found XML plugin but in the editor tool bar i didn't get the option. How can i enable that option from ckeditor.


texts: Views taxonomy terms page with two content types

texts:
This is the structure:

menu1 - taxonomy/term1
menu2 - taxonomy/term2
menu3 - taxonomy/term3
menu4 - taxonomy/term4

The custom content type is using taxonomy terms and with enabled Views Taxonomy term that comes with the module, every content is displaying very well in categories. I can see that uses path /taxonomy/term/%

I'm displaying the nodes as a grid style with specific fields.

Now I want to add a second content type that will use the same category from the first content type and will be displayed over the first content type nodes.

EDIT: I've tried to clone the view and change only one field, but it didn't work. The result is only the content from the fist view. I've used the same path like the default view taxonomy term, but I guess it's not possible to do like that.

EDIT2: So I can see that it's not possible to achieve with adding block and use the same url like the default view taxonomy term.

I've checked the taxonomy display module and I can see that I can associate only one view.


texts: Collapsiblock module - can I have horizontal expanding tabs instead of vertical?

texts:
Collapsiblock: http://drupal.org/project/collapsiblock

I am looking for a way to allow the sidebar blocks to be collapsible left-to-right instead of top-to-bottom using the Collapsiblock module. It would basically be a way to hide the left and right-column blocks until someone clicks the tab, after which the block would expand to the width of the column. It seems as though it should be a fairly straightforward change in the JS file, but I cannot figure it out. Can anyone here provide any insight into this?

Thanks!


texts: How to specify default options in a checkbox field using Field API

texts:
I am trying to add a checkbox field to user entities using the FIELD API (in function MYMODULE_install() )

I can create the field, but I can't pre-load it with the desired default values.

Where my code is wrong ?

$default_notification_field_name = "field_notification_defaults";
if(!field_info_field($default_notification_field_name))   { // check if the field already exists.

    field_create_field(
        array(
            'field_name' => $default_notification_field_name,
            'cardinality' => FIELD_CARDINALITY_UNLIMITED,
            'type' => 'list_text',
            'settings' => array(
                'allowed_values' => array(
                    'group' => t('Groups to which you subscribe'),
                    'content' => t('Authored content'),
                    'comment' => t('Replies to your comments')
                )
            ),
        )
    );

    field_create_instance(
        array(
            'field_name' => $default_notification_field_name,
            'entity_type' => 'user',
            'bundle' => 'user',
            'label' => t('Default settings for notifications'),
            'description' => t('Select the default notification options for the groups to which you subscribe, the contents you send and the replies to (your) comments. These default options can then be modified on a per-group, content or comment bases.'),
            'required' => FALSE,
            'widget' => array(
                'type' => 'options_buttons',
            ),
            'default_value' => array('content','comment')
        )
    );
}


texts:
I have a rule, that sets user expiration date from a date field (this is on the same user account, I need this for another rule). However, after the rule fires the user expiration date is beeing reset (in case no other data was set there, otherwise it gets back to the previously set date).
That means the rule works but it is useless, while something is overwrinting it.
the question is, why does user expiration resets.

The rule exported:

{ "rules_set_user_exp" : {
    "LABEL" : "set user exp",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "user_expire" ],
    "ON" : { "user_update" : [] },
    "IF" : [ { "NOT data_is_empty" : { "data" : [ "account:field-exp-date" ] } } ],
    "DO" : [
      { "user_expire" : { "account" : [ "account" ], "expiration" : [ "account:field-exp-date" ] } }
    ]
  }
}


texts: $node->type throwing PHP errors, occasionally

texts:
I've created some PHP code to get the node type, use it to get a filename, check if there is a banner image existing by that name; if the file doesn't exist, I render the default image.

In the images folder I'd have the following images.

images/content_type.jpg
images/default.jpg
images/careers.jpg

If the content type is careers, and there is an image called careers.jpg, then that image is displayed, but if that image isn't found then default.jpg is displayed.

    $type = $node->type;  // This is line 131.
    $type = preg_replace('/\s+/', '-', $type);
    $type = strtolower($type);

    $base_path_trimmed = $base_path;
    $base_path_trimmed = rtrim($base_path_trimmed, '/');

    $img_url = "$base_path_trimmed/sites/default/files/images/banners/sub-banners/$type.jpg"; //placed in variable so it's rendered out in $image
    $image = $_SERVER['DOCUMENT_ROOT'] . $img_url; //php is weird and checks from the server root rather than web root.

    if (file_exists($image)) {
      print "\n";
    }
    else {
      print "\n";
    }

The code works, except I sometimes get the following errors:

  Notice: Undefined variable: node in include() (line 131 of templates/page.tpl.php).
  Notice: Trying to get property of non-object in include() (line 131 of templates/page.tpl.php).

What can I do to avoid those errors? Is there a better way to write the code I need?

EDIT: Better way is to use the Dynamic Banner Module.


texts: Get entity reference node object from within rendered entity reference

texts:
My specific problem is similar to the one here but I am needing for it to work when the file field is within a node that is rendered within another as an entity reference.

If I use:

$node = \Drupal::request()->attributes->get('node');
$variables['node_title'] = $node->getTitle();

I get the title of the main node currently being displayed and not the node of the rendered entity reference. Is there a way I can get this instead?


texts: Best way to insert video (vimeo and youtube) into content

texts:
What is the best way to embed videos into content? Often it's not ideal just to have video content at the beginning or end end of page content. More often then not it something like
[text]
[video]
[text]

I'm looking at the best way to insert video content into a page while keeping a video content type field. I also want to avoid just adding video embed code into the full html body editor as then it's impossible to use the video in other places.

How do I go about adding a view field and then have a 'placeholder' for which to render the video in the middle of the text content?


texts: Rewrite empty Fields on Feeds periodic Import

texts:
I have set up a periodic feed importer in drupal which imports nodes and updates existing nodes.

Lets assume the imported xml consits of two fields: the title and a long text field.

I import the nodes in the morning with the following content:

title   long text field
1       long text 1
2       long text 2
3       long text 3

So three nodes were correctly created with the two fields. But if I import later and the content of the xml has changed to the following:

title   long text field
1       long text 1
2
3       long text 3

As you can see the long text field of the second node is empty, but feeds doesn't update the field. The value after reimport is still 'long text 2'.

I haven't found an option or a module to achieve this. I have tried to manipulate the input data via

hook_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {
  // replace empty results with ' ' (one space), so they gets replaced
  for ($i=0; $i < sizeof($result->items); $i++) {
    for ($o=0; $o < sizeof($result->items[$i]); $o++) {
      if (empty($result->items[$i]['xpathparser:'.$o])) {
        $result->items[$i]['xpathparser:'.$o] = ' ';
      }
    }
  }
}

But feeds only jumps into the function if it detects changes in the xml, but i think empty fields don't get considered.


texts: How can I prevent a user from logging in from more than one computer or browser?

texts: In the Drupal 7 web site I am developing, I have a requirement that will not allow a user to login from multiple computers or different browser (IE and FireFox) on the same computer.  It looks like the Session limit module used to handle this, but I don't see where it is even under development for Drupal 7.  Do you have any idea?


texts: Every link except home directes to 'Not found' page?

texts:
I have created site directly on the shared host server by downloading fresh Drupal 8. Every think went Ok with installation and site installed properly. But whenever I click on any link of admin bar or my-accont/logout it directs me to Not Found page.

For example I clicked on Extend from admin menu and following message did appear.

Not found message

Any idea why this is happening and how to correct that. Very thanks.


texts:
I am creating custom account management pages in drupal with quite a few criteria. The first being that there is a page at /account which contains two separate forms: 1) To enter a new email address and a confirm new email address 2) To enter a new password and confirm new password

I'd like other pages for example /account/orders to view past orders and /account/billing to edit credit card data and billing address (I'm using ubercart and authorize.net for e-commerce and credit card processing, respectively) How can I access the billing data (address and last 4 digits of credit card number) from ubercart?

What are some general tips for this? Should I create a custom "account" module? Should I just try to edit some existing templates somehow? I know I'm asking a lot of big questions, and I'm not asking for a complete answer. Just some general advice and ideas.

Also, I hate the user account pages with numbers in them identifying the user. It seems simple enough just to have it know depending on who is logged in (i.e. /user/5/edit vs. /user or /user/edit


texts: Remove "No front page content has been created yet"

texts:
How can I remove default system message like "No front page content has been created yet" in Drupal 8?

I've tried below method but is doesn't work.

function MYTHEME_preprocess_page(&$vars) {

  // Remove the "No front page content has been created yet.".
  if (isset($vars['page']['content']['system_main']['default_message'])) {

    unset($vars['page']['content']['system_main']['default_message']);
  }
}


texts: Search keyword with selectable exposed filters

texts:
I'm trying to make a search view with one textfields and two checkbox filters (body, tags). The search text would only search the selected fields and would show results as summaries.

I've tried combined fields filters in Views, but the filters selected are all enabled. Is there was a way to toggle the filters via checkbox?


texts: Publish node link to social media on content creation

texts:
I'm looking for a way to publish the node link to social media (Facebook, Twitter and Linkedin) on the creation of the node.

So what I would like is a little checkbox saying: publish to facebook on the node edit page.
Does anyone know a module that could help me achieve this?
Thanks !


texts: What's the data structure that needed by services for posting new node with drupal7 services?

texts:
I have content type named "shen" and gona to create new node with services module from crawl machine data.

For now, it can login in system and post new node but it can't save image field data.

this is the data It post to services module:

{'body': {'und': {'0': {'value': 'I am Shen'}}}, 'type': 'shen', 'field_shen_image': {'und': {'0': {'new': 1, 'display': 1, 'fid': '541'}}}, 'title': 'just a little title'}

I'm sure lost a little thing and really need your help.

Cheers


texts: Why do vertical images flip horizontal after upload?

texts:
I run into this issue once in a while and I am not sure what it is.  For example I have an image that I get from a non Drupal site or directly from a camera. If I view the image via Preview on my Mac or on a browser from the site it displays vertically. As soon as upload to my Drupal site, it flips horizontally.

To go around this I just open the image on my Mac and just re-save.

I always thought that my computer somehow is rotating the images just for display (based on some logic) but really in the background it is still a horizontal image. But I don't understand why the image displays correctly in the browser from the non Drupal site?


texts: Author information lost after saving node

texts:
I am developing a site using Drupal 6. Sometimes, when I edit and save a node, the author information is lost and the node is unpublished.

Some observations:

When I edit the node again, even with the user 1 account, I no longer get the node publication controls on the edit form.
In the content overview admin page, the column for author is empty, not 'anonymous'.
I can force-publish the node again using bulk operations, but not via the edit node page. I cannot seem to restore the/a author for the node.

I have not yet been able to reproduce this problem consistently: it happens on various node types, only sometimes, regardless of using tinyMCE or filtered HTML for content.

It does seem to happen only on edit, not create. I have not recently enabled or disabled any modules.

Has anyone else experienced something similar? Any idea as to what might be causing this?


texts: How to translate menu items with migrate?

texts:
I'm importing menu items from CSV using migrate, migrate_tools, migrate_plus and migrate_source_csv.

This is an example of how I'm doing it for the original language:

source:
  plugin: csv
  path: 'private://init/links_gl.csv'
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - id
  column_names:
    0:
      id: id
    1:
      source_id: source_id
    2:
      parent_id: parent_id
    3:
      menu_name: menu_name
    4:
      weight: weight
    5:
      title: title

  constants:
    path: 'entity:node/'

ids:
  id:
    type: string

process:
  title: title
  menu_name: menu_name
  nid:
    plugin: bbaa_migration_lookup
    migration: init_contents_gl
    source: source_id
  'link/uri':
    plugin: bbaa_concat
    source:
      - constants/path
      - '@nid'
  parent:
    plugin: menu_link_parent
    source:
      - parent_id
      - '@menu_name'
  external:
    plugin: default_value
    default_value: 0
  expanded:
    plugin: default_value
    default_value: 1
  enabled:
    plugin: default_value
    default_value: 1
  langcode:
    plugin: default_value
    default_value: 'gl'
  weight: weight

destination:
  plugin: entity:menu_link_content
  bundle: menu_link_content
  no_stub: true

It's working but now I need to import another CSV file with translated menu items.

I created another migration configuration for the translated language and I tried adding this code:

  id:
    plugin: migration
    source: id
    migration: init_links_gl
  content_translation_source:
    plugin: default_value
    default_value: 'gl'
  langcode:
    plugin: default_value
    default_value: 'es'

destination:
  plugin: entity:menu_link_content
  translations: true
  no_stub: true

But it doesn't work.

How can I translate menu items with migrate?


texts:
I have a Drupal 7 site and I would like to change the view format with a button click, so I want to ask if it is a way to change the configuration of a View page with php.

In a view page configuration, the option is this:

Now it has "List without format" value.


texts: DRUPAL 7.33 - When i try to save a node with upload, i receive website encountered unexpected error...PDOException: SQLSTATE[25P02]

texts:
In my postgresql log i have error on this select:

SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp, base.type AS type
    FROM
    file_managed base
    WHERE  (base.fid IN  ('resultadopdf_1'))

The file is uploaded, but the node not... I want to understand why the select compare a field id (integer) with a string...
Someone know where this select is made?

After aplied patch:

PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERRO: current transaction has been halted , commands ignored until end of transaction block: SELECT column_name, data_type, column_default FROM information_schema.columns WHERE table_schema = :schema AND table_name = :table AND (data_type = 'bytea' OR (numeric_precision IS NOT NULL AND column_default LIKE :default)); Array ( [:schema] => public [:table] => node [:default] => %nextval% ) em drupal_write_record() (linha 7239 de /var/www/portalunifei/includes/common.inc).

But in then postgrelog shows:

ERRO:  input syntax for integer is invalid: "notaspng" at character 256
COMANDO:  SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp, base.type AS type
    FROM
    file_managed base
    WHERE  (base.fid IN  ('notaspng'))
ERRO:  current transaction has been halted , commands ignored until end of transaction block
COMANDO:  SELECT column_name, data_type, column_default FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'node' AND (data_type = 'bytea' OR (numeric_precision IS NOT NULL AND column_default::text LIKE '%nextval%'))
LOG:  duração: 0.025 ms  comando: ROLLBACK